瀏覽代碼

feat:系统设置模块

snow 1 年之前
父節點
當前提交
3ab0f9957a
共有 75 個文件被更改,包括 5387 次插入1595 次删除
  1. 7 8
      src/apis/axios.js
  2. 5 5
      src/apis/service/customerService/demandOrder/index.js
  3. 2 2
      src/apis/service/serviceParam/demandProject/index.js
  4. 2 2
      src/apis/service/serviceParam/industryLabel/index.js
  5. 2 2
      src/apis/service/serviceParam/industryManagement/index.js
  6. 29 20
      src/apis/service/serviceParam/organize/index.js
  7. 2 2
      src/apis/service/serviceParam/prepaidProportional/index.js
  8. 5 5
      src/apis/service/serviceParam/sort/index.js
  9. 2 2
      src/apis/service/serviceParam/storeCharacteristics/index.js
  10. 2 2
      src/apis/service/serviceParam/storeType/index.js
  11. 4 4
      src/apis/service/serviceParam/supplier/index.js
  12. 15 0
      src/apis/service/system/action/index.js
  13. 20 0
      src/apis/service/system/button/index.js
  14. 18 14
      src/apis/service/system/menu/index.js
  15. 16 6
      src/apis/service/system/operationAccount/index.js
  16. 21 0
      src/apis/service/system/role/index.js
  17. 3 2
      src/apis/service/user/index.js
  18. 29 25
      src/apis/user/axios.js
  19. 15 15
      src/apis/user/index.js
  20. 6 3
      src/components/tableEditor/src/index.vue
  21. 4 3
      src/config/env.development.js
  22. 0 48
      src/layout/components/Navbar.vue
  23. 1 1
      src/layout/components/Sidebar/Logo.vue
  24. 5 7
      src/layout/components/password-modal/index.vue
  25. 7 0
      src/mixins/response.js
  26. 639 0
      src/store/modules/_user.js
  27. 47 257
      src/store/modules/user.js
  28. 20 16
      src/views/customerService/demandOrder/components/demandDetail/requsetPerpaymentModal.vue
  29. 24 30
      src/views/customerService/demandOrder/components/demandDetail/uploadCertificateModal.vue
  30. 17 1
      src/views/customerService/demandOrder/letterEditing.vue
  31. 4 1
      src/views/customerService/invoiceApproval/columns.js
  32. 83 0
      src/views/customerService/invoiceApproval/components/approvalModal.vue
  33. 10 6
      src/views/customerService/invoiceApproval/index.vue
  34. 16 44
      src/views/login/index.vue
  35. 4 1
      src/views/platformService/invoice/columns.js
  36. 19 13
      src/views/platformService/invoice/index.vue
  37. 16 9
      src/views/serviceParam/Invoicing/addEdit.vue
  38. 0 7
      src/views/serviceParam/Invoicing/index.vue
  39. 11 6
      src/views/serviceParam/demand/addEdit.vue
  40. 0 2
      src/views/serviceParam/demand/index.vue
  41. 0 0
      src/views/serviceParam/demand/需求管理
  42. 0 6
      src/views/serviceParam/demandProject/index.vue
  43. 3 8
      src/views/serviceParam/industryManagement/index.vue
  44. 0 0
      src/views/serviceParam/industryTag/addEdit.vue
  45. 1 1
      src/views/serviceParam/industryTag/index.vue
  46. 0 0
      src/views/serviceParam/industryTag/行业标签管理
  47. 357 159
      src/views/serviceParam/organize/addEdit.vue
  48. 300 0
      src/views/serviceParam/organize/contactModal.vue
  49. 341 350
      src/views/serviceParam/organize/index.vue
  50. 0 0
      src/views/serviceParam/organize/企业客户组织架构
  51. 1 3
      src/views/serviceParam/prepaidProportional/index.vue
  52. 17 31
      src/views/serviceParam/sort/addEdit.vue
  53. 14 35
      src/views/serviceParam/sort/index.vue
  54. 1 8
      src/views/serviceParam/storeType/index.vue
  55. 141 78
      src/views/serviceParam/supplier/components/baseForm.vue
  56. 3 7
      src/views/serviceParam/supplier/detail.vue
  57. 32 55
      src/views/serviceParam/supplier/index.vue
  58. 63 63
      src/views/serviceParam/supplierStore/components/baseForm.vue
  59. 13 13
      src/views/serviceParam/supplierStore/storeDecoration.vue
  60. 716 0
      src/views/system/action/index.vue
  61. 0 0
      src/views/system/action/功能权限
  62. 306 0
      src/views/system/button/addEdit.vue
  63. 410 0
      src/views/system/button/index.vue
  64. 0 0
      src/views/system/button/按钮管理
  65. 29 25
      src/views/system/menuOperator/addEdit.vue
  66. 61 36
      src/views/system/menuOperator/index.vue
  67. 60 18
      src/views/system/operationAccount/addEdit.vue
  68. 92 0
      src/views/system/operationAccount/components/setRoleModal.vue
  69. 26 42
      src/views/system/operationAccount/index.vue
  70. 0 0
      src/views/system/operationAccount/账号管理
  71. 838 0
      src/views/system/role/addEdit.vue
  72. 355 0
      src/views/system/role/index.vue
  73. 0 0
      src/views/system/role/角色管理
  74. 25 41
      src/views/system/setBtn/addEdit.vue
  75. 50 45
      src/views/system/setBtn/index.vue

+ 7 - 8
src/apis/axios.js

@@ -87,14 +87,13 @@ export default async(
 axios.interceptors.response.use(
   async response => {
     if (response.status === 200) {
-      const code = response.data.code
-      const message = response.data.message
-
-      if (code >= 100 && code <= 104 && message !== '账户已禁用' && message !== '没有该公司的默认角色') {
-        removeToken()
-        removeMenu()
-        removeBtn()
-      }
+     // const code = response.data.code
+     // const message = response.data.message
+      // if (code >= 100 && code <= 104 && message !== '账户已禁用' && message !== '没有该公司的默认角色') {
+      //   removeToken()
+      //   removeMenu()
+      //   removeBtn()
+      // }
     }
     return response
   },

+ 5 - 5
src/apis/service/customerService/demandOrder/index.js

@@ -21,7 +21,7 @@ export default {
 
   // 删除
   delete: (data, params) => http(api + "delete", data, "post", params),
- 
+
   // 项目详情
   pdetail: (data, params) => http(api + "projectinfo", data, "post", params),
   // 议价单创建
@@ -34,11 +34,11 @@ export default {
   // 企业客户反馈
   aftergys: (data, params) => http(api + "aftergys", data, "post", params),
   // 售后快递录入
-  afterPost: (data, params) => http(api + "afterpost ", data, "post", params),
+  afterPost: (data, params) => http(api + "afterpost", data, "post", params),
   //售后获取仓库list
-  afterwsm: (data, params) => http(api + "afterwsm ", data, "post", params),
+  afterwsm: (data, params) => http(api + "afterwsm", data, "post", params),
 
 
-  uploadImage: (data, params) => http(api + "uploadimg ", data, "post", params),
-  uploadvideo: (data, params) => http(api + "uploadvideo ", data, "post", params),
+  uploadImage: (data, params) => http(api + "uploadimg", data, "post", params),
+  uploadvideo: (data, params) => http(api + "uploadvideo", data, "post", params),
 };

+ 2 - 2
src/apis/service/serviceParam/demandProject/index.js

@@ -1,13 +1,13 @@
 // 物业管理员
 import http from "@/apis/axios";
-const api = "admin/";
+const api = "admin/service_item/";
 export default {
   // 添加
   add: (data, params) => http(api + "unitcreate", data, "post", params),
   // 更新
   update: (data, params) => http(api + "unitedit", data, "post", params),
   // 分页查询
-  list: (data, params) => http(api + "unitlist", data, "post", params),
+  list: (data, params) => http(api + "index", data, "post", params),
   // 删除
   delete: (data, params) => http(api + "unitdelete", data, "post", params),
   // 修改状态

+ 2 - 2
src/apis/service/serviceParam/industryLabel/index.js

@@ -1,13 +1,13 @@
 // 物业管理员
 import http from "@/apis/axios";
-const api = "admin/";
+const api = "admin/industry_tag/";
 export default {
   // 添加
   add: (data, params) => http(api + "unitcreate", data, "post", params),
   // 更新
   update: (data, params) => http(api + "unitedit", data, "post", params),
   // 分页查询
-  list: (data, params) => http(api + "unitlist", data, "post", params),
+  list: (data, params) => http(api + "index", data, "post", params),
   // 删除
   delete: (data, params) => http(api + "unitdelete", data, "post", params),
   // 修改状态

+ 2 - 2
src/apis/service/serviceParam/industryManagement/index.js

@@ -1,13 +1,13 @@
 // 物业管理员
 import http from "@/apis/axios";
-const api = "admin/";
+const api = "admin/industry/";
 export default {
   // 添加
   add: (data, params) => http(api + "unitcreate", data, "post", params),
   // 更新
   update: (data, params) => http(api + "unitedit", data, "post", params),
   // 分页查询
-  list: (data, params) => http(api + "unitlist", data, "post", params),
+  list: (data, params) => http(api + "index", data, "post", params),
   // 删除
   delete: (data, params) => http(api + "unitdelete", data, "post", params),
   // 修改状态

+ 29 - 20
src/apis/service/serviceParam/organize/index.js

@@ -1,22 +1,31 @@
-// 账号
-import http from '@/apis/axios'
-const api = 'admin/'
+// 企业客户/供应商账号相关
+import http from "@/apis/axios";
+const api = "admin/customer_item/";
+
 export default {
-  // 分页查询
-  list: (data, params) => http(api + 'ulist', data, 'post', params),
-  // 详情
-  detail: (data, params) => http(api + 'query', data, 'post', params),
-  // 更新
-  update: (data, params) => http(api + 'refresh', data, 'post', params),
-  // 添加
-  add: (data, params) => http(api + 'add', data, 'post', params),
-  // 删除
-  delete: (data, params) => http(api + 'itemdel', data, 'post', params),
-  // 修改状态
-  status: (data, params) => http(api + 'stat', data, 'post', params),
-  // 拉取角色列表
-  getRole: (data, params) => http(api + 'roleall', data, 'post', params),
-  // 设置部门负责人
-  userp: (data, params) => http(api + 'userp', data, 'post', params),
+    // 列表
+    list: (data, params) => http(api + "list", data, "post", params),
+    // 组织新建
+    zadd: (data, params) => http(api + "create", data, "post", params),
+    // 组织详情
+    zdetail: (data, params) => http(api + "customerselect", data, "post", params),
+    // 组织更新
+    zupdate: (data, params) => http(api + "update", data, "post", params),
+    // 组织删除
+    zdelete: (data, params) => http(api + "customerdelect", data, "post", params),
+    // 组织状态
+    zstatus: (data, params) => http(api + "status", data, "post", params),
+
+
+    // 企业新建
+    qadd: (data, params) => http(api + "customarcreate", data, "post", params),
+    // 企业更新
+    qupdate: (data, params) => http(api + "customaredit", data, "post", params),
+    // 企业详情
+    qdetail: (data, params) => http(api + "customarinfo", data, "post", params),
+    // 企业删除
+    qdelete: (data, params) => http(api + "customardelete", data, "post", params),
+    // 企业状态
+    qstatus: (data, params) => http(api + "customarstatus", data, "post", params),
 
-}
+};

+ 2 - 2
src/apis/service/serviceParam/prepaidProportional/index.js

@@ -1,13 +1,13 @@
 // 物业管理员
 import http from "@/apis/axios";
-const api = "admin/";
+const api = "admin/prepayratio/";
 export default {
   // 添加
   add: (data, params) => http(api + "unitcreate", data, "post", params),
   // 更新
   update: (data, params) => http(api + "unitedit", data, "post", params),
   // 分页查询
-  list: (data, params) => http(api + "unitlist", data, "post", params),
+  list: (data, params) => http(api + "list", data, "post", params),
   // 删除
   delete: (data, params) => http(api + "unitdelete", data, "post", params),
   // 修改状态

+ 5 - 5
src/apis/service/serviceParam/sort/index.js

@@ -1,19 +1,19 @@
 // 物业管理员
 import http from '@/apis/axios'
-const api = 'admin/'
+const api = 'admin/service_cat/'
 export default {
   // 添加
-  add: (data, params) => http(api + 'catcreate', data, 'post', params),
+  add: (data, params) => http(api + 'create', data, 'post', params),
   // 删除
   delete: (data, params) => http(api + 'delete', data, 'post', params),
   // 分页查询
-  list: (data, params) => http(api + 'catplist', data, 'post', params),
+  list: (data, params) => http(api + 'list', data, 'post', params),
   // 详情
   detail: (data, params) => http(api + 'catinfo', data, 'post', params),
   // 更新
-  update: (data, params) => http(api + 'catedit', data, 'post', params),
+  update: (data, params) => http(api + 'save', data, 'post', params),
   // 修改状态
-  status: (data, params) => http(api + 'catstatus', data, 'post', params),
+  status: (data, params) => http(api + 'status', data, 'post', params),
   // 商品分类列表
   goodsList: (data, params) => http(api + 'catlist', data, 'post', params),
   // 全部规格列表

+ 2 - 2
src/apis/service/serviceParam/storeCharacteristics/index.js

@@ -1,13 +1,13 @@
 // 物业管理员
 import http from "@/apis/axios";
-const api = "admin/";
+const api = "admin/store_type/";
 export default {
   // 添加
   add: (data, params) => http(api + "unitcreate", data, "post", params),
   // 更新
   update: (data, params) => http(api + "unitedit", data, "post", params),
   // 分页查询
-  list: (data, params) => http(api + "unitlist", data, "post", params),
+  list: (data, params) => http(api + "index", data, "post", params),
   // 删除
   delete: (data, params) => http(api + "unitdelete", data, "post", params),
   // 修改状态

+ 2 - 2
src/apis/service/serviceParam/storeType/index.js

@@ -1,13 +1,13 @@
 // 物业管理员
 import http from "@/apis/axios";
-const api = "admin/";
+const api = "admin/store_type/";
 export default {
   // 添加
   add: (data, params) => http(api + "unitcreate", data, "post", params),
   // 更新
   update: (data, params) => http(api + "unitedit", data, "post", params),
   // 分页查询
-  list: (data, params) => http(api + "unitlist", data, "post", params),
+  list: (data, params) => http(api + "index", data, "post", params),
   // 删除
   delete: (data, params) => http(api + "unitdelete", data, "post", params),
   // 修改状态

+ 4 - 4
src/apis/service/serviceParam/supplier/index.js

@@ -1,19 +1,19 @@
 // 物业管理员
 import http from '@/apis/axios'
-const api = 'admin/'
+const api = 'admin/supplier/'
 export default {
   // 添加
-  add: (data, params) => http(api + 'supplercreate', data, 'post', params),
+  add: (data, params) => http(api + 'create', data, 'post', params),
   // 删除
   delete: (data, params) => http(api + 'supplerdelete', data, 'post', params),
   // 分页查询
-  list: (data, params) => http(api + 'supplerlist', data, 'post', params),
+  list: (data, params) => http(api + 'list', data, 'post', params),
   // 更新
   update: (data, params) => http(api + 'suppleredit', data, 'post', params),
   // 修改状态
   status: (data, params) => http(api + 'supplerstatus', data, 'post', params),
   // 详情
-  detail: (data, params) => http(api + 'supplerinfo', data, 'post', params),
+  detail: (data, params) => http(api + 'info', data, 'post', params),
   // 升级为业务公司
   inv_update: (data, params) => http(api + 'supplerUpgrade', data, 'post', params),
 

+ 15 - 0
src/apis/service/system/action/index.js

@@ -0,0 +1,15 @@
+// 功能权限
+import http from '@/apis/axios'
+const api = 'admin/role/'
+
+const roleAPI = "admin/role_action/"
+export default {
+  // 详情
+  detail: (data, params) => http(roleAPI + 'query', data, 'post', params),
+  // 更新
+  update: (data, params) => http(roleAPI + 'create', data, 'post', params),
+  // 拉取角色列表
+  getRole: (data, params) => http(api + 'query', data, 'post', params),
+  // 功能权限列表
+  actionList: (data, params) => http(roleAPI + 'menuaction', data, 'post', params)
+}

+ 20 - 0
src/apis/service/system/button/index.js

@@ -0,0 +1,20 @@
+// 运营账号
+import http from '@/apis/axios'
+const api = 'admin/action/'
+
+export default {
+  // 分页查询
+  list: (data, params) => http(api + 'list', data, 'post', params),
+  // 添加
+  add: (data, params) => http(api + 'add', data, 'post', params),
+  // 更新
+  update: (data, params) => http(api + 'edit', data, 'post', params),
+   // 删除
+  delete: (data, params) => http(api + 'delete', data, 'post', params),
+    // 修改状态
+  status: (data, params) => http(api + 'status', data, 'post', params),
+  // 详情
+  detail: (data, params) => http(api + 'userinfo', data, 'post', params),
+  // 修改密码
+  setpwd: (data, params) => http(api + 'userCompanyBasicPassword', data, 'post', params),
+}

+ 18 - 14
src/apis/service/system/menu/index.js

@@ -1,26 +1,30 @@
 // 系统权限-菜单管理-贾增超
 import http from '@/apis/axios'
-const api = 'admin/'
+const api = 'admin/menu/'
+
+const actionAPI = 'admin/action/'
 export default {
   // 分页查询
-  list: (data, params) => http(api + 'menulist', data, 'post', params),
+  list: (data, params) => http(api + 'query', data, 'post', params),
+  create: (data, params) => http(api + 'create', data, 'post', params),
+  // 菜单删除
+  menudel: (data, params) => http(api + 'delete', data, 'post', params),
   // 更新
-  update: (data, params) => http(api + 'menusave', data, 'post', params),
+  update: (data, params) => http(api + 'edit', data, 'post', params),
   // 菜单状态
-  menustatus: (data, params) => http(api + 'menustatus', data, 'post', params),
-  // 菜单删除
-  menudel: (data, params) => http(api + 'menudel', data, 'post', params),
+  menustatus: (data, params) => http(api + 'status', data, 'post', params),
 
   // 按钮
-  // 列表
-  actionList: (data, params) => http(api + 'menuaction', data, 'post', params),
   // 添加
-  actionadd: (data, params) => http(api + 'menuactionadd', data, 'post', params),
+  actionadd: (data, params) => http(actionAPI + 'menuactioncreate', data, 'post', params),
+  // 列表
+  actionList: (data, params) => http(actionAPI + 'menuaction', data, 'post', params),
   // 更新
-  actionedit: (data, params) => http(api + 'menuactionsave', data, 'post', params),
+  actionedit: (data, params) => http(actionAPI + 'edit', data, 'post', params),
   // 状态
-  actionstatus: (data, params) =>
-    http(api + 'menuactionstatus', data, 'post', params),
-      // 删除
-  actiondel: (data, params) => http(api + 'menuactiondel', data, 'post', params),
+  actionstatus: (data, params) => http(actionAPI + 'status', data, 'post', params),
+  // 删除
+  actiondel: (data, params) => http(actionAPI + 'menuactiondel', data, 'post', params),
+
+  actionQuery:(data,params) => http(actionAPI + "query",data,'post',params)
 }

+ 16 - 6
src/apis/service/system/operationAccount/index.js

@@ -1,20 +1,30 @@
 // 运营账号
 import http from '@/apis/axios'
-const api = 'admin/'
+const api = 'admin/user/'
+
+const loginAPI = "admin/login/"
+
+const roleAPI = "admin/role/"
 
 export default {
   // 分页查询
-  list: (data, params) => http(api + 'userlist', data, 'post', params),
+  list: (data, params) => http(api + 'list', data, 'post', params),
   // 详情
   detail: (data, params) => http(api + 'userinfo', data, 'post', params),
   // 更新
-  update: (data, params) => http(api + 'userCompanyBasicUpdate', data, 'post', params),
-  // 添加
-  add: (data, params) => http(api + 'userCompanyAdd', data, 'post', params),
+  update: (data, params) => http(api + 'edit', data, 'post', params),
   // 删除
   delete: (data, params) => http(api + 'userCompanyBasicDelete', data, 'post', params),
   // 修改密码
   setpwd: (data, params) => http(api + 'userCompanyBasicPassword', data, 'post', params),
   // 修改状态
-  status: (data, params) => http(api + 'userCompanyBasicStatus', data, 'post', params)
+  status: (data, params) => http(api + 'userCompanyBasicStatus', data, 'post', params),
+
+  // 设置角色
+  setRole: (data,params) => http(api + "setrole", data, "post", params),
+
+  // 注册
+  register: (data, params) => http(loginAPI + '/register', data, 'post', params),
+  //获取不分页角色列表
+  roleQuery : (data,params) => http(roleAPI + "query", data, "post", params)
 }

+ 21 - 0
src/apis/service/system/role/index.js

@@ -0,0 +1,21 @@
+// 物业管理员
+import http from '@/apis/axios'
+const api = 'admin/role/'
+
+const actAPI = 'admin/role_action/'
+export default {
+  // 添加
+  add: (data, params) => http(api + 'create', data, 'post', params),
+  // 查询列表
+  list: (data, params) => http(api + 'list', data, 'post', params),
+  // 更新
+  update: (data, params) => http(api + 'edit', data, 'post', params),
+  // 修改状态
+  status: (data, params) => http(api + 'status', data, 'post', params),
+  delete: (data, params) => http(api + 'delete', data, 'post', params),
+
+  // 功能权限列表
+  actionList: (data, params) => http(actAPI + 'menuaction', data, 'post', params),
+    // 详情
+  detail: (data, params) => http(actAPI + 'query', data, 'post', params),
+}

+ 3 - 2
src/apis/service/user/index.js

@@ -1,15 +1,16 @@
 import http from '@/apis/userAxios'
 import https from '@/apis/axios'
+
 export default {
   // 获取验证码
   verfiy: (data, params) => http(`admin/verify_code`, data, 'post', params),
   // 密码重置
-  resetpwd: (data, params) => http(`admin/passmobile`, data, 'post', params),
+  resetpwd: (data, params) => http(`admin/user/passmobile`, data, 'post', params),
   // 手机号更换
   resetmobile: (data, params) =>
     http(`Api/resetmobile`, data, 'post', params),
   // 密码修改
-  setpwd: (data, params) => http(`admin/passSetByPassword`, data, 'post', params),
+  setpwd: (data, params) => http(`admin/user/checkpassword`, data, 'post', params),
   // 获取导航列表
   list: (data, params) => http(`admin/menu`, data, 'post', params),
   // 获取个人信息

+ 29 - 25
src/apis/user/axios.js

@@ -5,6 +5,7 @@ import store from '@/store'
 import {
   getToken
 } from '@/utils/auth'
+import {Message} from "element-ui";
 const header = {
   // "X-Requested-With": "XMLHttpRequest",
   // "X-Frame-Options": "DENY", // 告诉浏览器不要(DENY)把这个网页放在iFrame内,通常的目的就是要帮助用户对抗点击劫持。
@@ -20,25 +21,12 @@ export default async(
   onUploadProgress
 ) => {
   type = url.method.toLowerCase()
-  // console.log(url)
   const obj = {
     method: type,
     baseURL: '',
     url: url.url,
     data: url.data,
     params,
-    // // `onUploadProgress` 允许为上传处理进度事件
-    // onUploadProgress: function(progressEvent) {
-    //   // 对原生进度事件的处理
-    // },
-    // // `onDownloadProgress` 允许为下载处理进度事件
-    // onDownloadProgress: function(progressEvent) {
-    //   // 对原生进度事件的处理
-    // },
-    // `cancelToken` 指定用于取消请求的 cancel token
-    // (查看后面的 Cancellation 这节了解更多)
-    // cancelToken: new CancelToken(function (cancel) {
-    // }),
     processData: true, // 告诉axios不要去处理发送的数据(重要参数)
     timeout: window.ajaxTimeout,
     headers,
@@ -65,31 +53,47 @@ axios.interceptors.request.use(
     if (!config.data.token) {
       config.data.token = getToken()
     }
-    const { noRelation, needRela, relaComNo } = config.data
-    const innerRelaComNo = store.state.user.currentCompany
-    // 决定传递关联公司:非超管用户且单独的请求中data中没有设置noRelation
-    // needRela: 超管需要传递关联公司(默认超管不传递)
-    // noRelation: 普通用户不传递关联公司(默认普通用户传递)
-    const isAllowRelaComNo = !store.state.user.isSupertube && !noRelation
-    config.data.relaComNo = isAllowRelaComNo ? innerRelaComNo : ''
-    if (needRela) config.data.relaComNo = relaComNo || innerRelaComNo
-
-    const deleteKeys = ['needRela', 'noRelation']
-    deleteKeys.forEach(key => key in config.data && delete config.data[key])
+    // const { noRelation, needRela, relaComNo } = config.data
+    // const innerRelaComNo = store.state.user.currentCompany
+    // // 决定传递关联公司:非超管用户且单独的请求中data中没有设置noRelation
+    // // needRela: 超管需要传递关联公司(默认超管不传递)
+    // // noRelation: 普通用户不传递关联公司(默认普通用户传递)
+    // const isAllowRelaComNo = !store.state.user.isSupertube && !noRelation
+    // config.data.relaComNo = isAllowRelaComNo ? innerRelaComNo : ''
+    // if (needRela) config.data.relaComNo = relaComNo || innerRelaComNo
+    // const deleteKeys = ['needRela', 'noRelation']
+    // deleteKeys.forEach(key => key in config.data && delete config.data[key])
     return config
   },
-  () => {
+  function(){
     // 错误抛到业务代码
     return Promise.reject(new Error('服务器异常,请联系管理员!'))
   }
 )
 
+
 // 添加响应拦截器
 axios.interceptors.response.use(
   async response => {
+      // TODO:修改响应code判断
+      const { data } = response
+      const { code, msg } = data;
+      switch (Number(code)){
+          case 0:
+              // 正常提示错误 ...
+              Message.warning(msg)
+              break
+          case 101:
+              // token验证错误,登出 ...
+              break
+          default:
+              // TODO 正常响应 ...
+              break
+      }
     return response
   },
   error => {
+      console.log(error)
     return Promise.reject(error.response.data)
   }
 )

+ 15 - 15
src/apis/user/index.js

@@ -3,27 +3,27 @@ import urlConfig from '@/apis/url-config'
 import { getToken } from '@/utils/auth'
 // 登录
 export function login(data) {
-  const _data = {
-    ...data,
-    noRelation: true
-  }
   return http({
-    url: `${urlConfig.baseURL}admin/login`,
+    url: `${urlConfig.baseURL}admin/login/login`,
     method: 'post',
-    data: _data
+    data
   })
 }
+
+export function requestMenus(data = {}){
+  return http({
+    url: `${urlConfig.baseURL}admin/menu/query`,
+    method: 'post',
+    data
+  })
+}
+
 // 获取个人信息
 export function userinfo(data) {
-  const _data = {
-    ...data,
-    noRelation: true
-  }
-
   return http({
-    url: `${urlConfig.baseURL}admin/userinfo`,
+    url: `${urlConfig.baseURL}admin/login/index`,
     method: 'post',
-    data: _data
+    data
   })
 }
 
@@ -47,10 +47,10 @@ export function dingdingdetail(data) {
 export function usergetinfo(data) {
   const _data = {
     ...data,
-    noRelation: true
+   // noRelation: true
   }
   return http({
-    url: `${urlConfig.baseURL}admin/userinfo`,
+    url: `${urlConfig.baseURL}admin/login/index`,
     method: 'post',
     data: _data
   })

+ 6 - 3
src/components/tableEditor/src/index.vue

@@ -58,11 +58,11 @@
         </template>
       </el-table-column>
 
-      <el-table-column label="操作" width="100px">
+      <el-table-column label="操作" width="100px" v-if="!readonly">
         <template #header>
           <div class="flex-between">
             <p>操作</p>
-            <el-button type="text" size="mini" @click="onInsertData">添加</el-button>
+            <el-button v-if="!readonly" type="text" size="mini" @click="onInsertData">添加</el-button>
           </div>
         </template>
 
@@ -71,7 +71,7 @@
             <el-button type="text" size="mini" @click="onCurrentRowSave(scope.row, scope.$index)">保存</el-button>
           </template>
 
-          <template v-else>
+          <template>
             <el-button type="text" size="mini" @click="onCurrentRowDelete(scope.$index)">删除</el-button>
             <el-button type="text" size="mini" @click="onCurrentRowEdit(scope.row, scope.$index)">编辑</el-button>
           </template>
@@ -133,6 +133,9 @@ export default {
     },
     onConfirm:{
       type:Function
+    },
+    readonly:{
+      type:Boolean
     }
   },
   watch:{

+ 4 - 3
src/config/env.development.js

@@ -1,10 +1,11 @@
 // 生产环境
 module.exports = {
-  title: '采销平台',
+  title: '阳光会务',
   baseUrl: 'http://wx.wxhr.sit.futurelab.tv',
   api: {
-    baseApi: 'http://stocknew.test241.wanyuhengtong.com/'
-    // baseApi: 'http://stockwm.test241.wanyuhengtong.com/'
+    // baseApi: 'http://stocknew.test241.wanyuhengtong.com/'
+     baseApi:'http://hwpro.test241.wanyuhengtong.com/'
+
   },
   webUrl: 'http://project.web.caixiao365.com/#/test-good-share?id=',
   fileURL: `https://api2.edu.futurelab.tv`,

+ 0 - 48
src/layout/components/Navbar.vue

@@ -13,54 +13,6 @@
     </div>
 
     <div class="right-menu">
-      <div class="right-menu-item">
-        <company-select
-          ref="companySelect"
-          select-all
-          global
-          placeholder="请选择供应商"
-          :style="{ width: device === 'mobile' ? '200px' : '400px' }"
-        />
-      </div>
-
-      <el-tooltip placement="bottom" :content="switchAccountModeText">
-        <i
-          v-if="isSupertube"
-          class="el-icon-sort right-menu-item hover-effect"
-          style="
-            height: 50px;
-            width: 35px;
-            line-height: 52px;
-            font-size: 22px;
-            transform: rotate(90deg);
-          "
-          @click="onSwitchCompanyMode"
-        />
-      </el-tooltip>
-      <!-- <el-tooltip
-        v-if="device !== 'mobile'"
-        placement="bottom"
-        content="登录工单管理系统"
-      >
-        <p
-          style="font-size:14px;color:#5a5e66;font-weight:500;line-height:54px;margin:0px 5px;cursor:pointer"
-          @click="openSettlementSystem(GDurl)"
-        >
-          工单
-        </p>
-      </el-tooltip> -->
-      <el-tooltip
-        v-if="device !== 'mobile'"
-        placement="bottom"
-        content="登录采销结算平台"
-      >
-        <i
-          class="el-icon-s-promotion right-menu-item hover-effect"
-          style="height: 50px; width: 40px; line-height: 52px; font-size: 22px"
-          @click="openSettlementSystem(JSurl)"
-        />
-      </el-tooltip>
-
       <template v-if="device !== 'mobile'">
         <i
           v-if="isShow"

+ 1 - 1
src/layout/components/Sidebar/Logo.vue

@@ -24,7 +24,7 @@ export default {
   },
   data() {
     return {
-      title: '采销365',
+      title: '阳光会务',
       logo: require('@/assets/img/logo.gif')
     }
   }

+ 5 - 7
src/layout/components/password-modal/index.vue

@@ -162,18 +162,16 @@ export default {
           if (!this.loading) {
             this.loading = true
             const model = {
-              old_pass: this.loginForm.oldPassword,
-              new_pass: this.loginForm.newPassword
+              password: this.loginForm.oldPassword,
+              new_password: this.loginForm.newPassword,
+              confirm_password:this.loginForm.confirmPassword
             }
             asyncRequest.setpwd(model).then(async(res) => {
-              if (res && res.code === 0) {
+              if (res && res.code === 1) {
                 this.loading = false
-                this.$message.success(res.message)
-                await this.logout()
-              } else if (res && res.code >= 100 && res.code <= 104) {
+                this.$message.success("密码修改成功!")
                 await this.logout()
               } else {
-                this.$message.warning(res.message)
                 this.loading = false
                 this._visible = false
               }

+ 7 - 0
src/mixins/response.js

@@ -0,0 +1,7 @@
+const response = {
+  data(){
+    return {
+      menus:[]
+    }
+  }
+}

+ 639 - 0
src/store/modules/_user.js

@@ -0,0 +1,639 @@
+import router from "@/router";
+
+import {
+  login,
+  menuList,
+  dingdingdetail,
+  usergetinfo,
+  roleProcessInfo,
+  requsetSupertubeCompany,
+  requsetUserBindingCompany,
+  reuqsetRoleInfo
+} from "@/apis/user";
+
+import {
+  getToken,
+  setToken,
+  removeToken,
+  getMenu,
+  setMenu,
+  removeMenu,
+  getBtn,
+  setBtn,
+  removeBtn,
+  get_business_company,
+  set_business_company,
+  remove_business_company,
+  get_business_companyNo,
+  set_business_companyNo,
+  remove_business_companyNo,
+  get_private_field,
+  set_private_field,
+  remove_private_field,
+  get_action_data,
+  set_action_data,
+  remove_action_data,
+  get_role_level,
+  getUserCompany,
+  setUserCompany,
+  removeUserCompany,
+  setUserInfo as _setUserInfo,
+  getUserInfo as _getUserInfo,
+  removeUserInfo as _removeUserInfo,
+  getCompanyType as _getCompanyType,
+  setCompanyType as _setCompanyType,
+  removeCompanyType as _removeCompanyType
+} from '@/utils/auth'
+
+
+import { MessageBox } from "element-ui";
+import { convertCompanylist } from "@/utils";
+
+export const userStoreActions = {
+  reloadMenu: 'user/reloadMenulist',
+  loginByToken: 'user/loginByToken',
+  setCompanyList: 'user/setCompanylist',
+  setCurrentLevel: 'user/setCurrentLevel',
+  setCurrentCompany: 'user/setCurrentCompany'
+}
+
+const state = {
+  token: getToken(),
+  name: "",
+  avatar: require("@/assets/img/avatar.gif"),
+  introduction: "",
+  roles: ["admin"],
+  btnList: getBtn(),
+  navList: getMenu(),
+  role_level:get_role_level() || "1",
+  business_company: get_business_company() || "",
+  business_companyNo: get_business_companyNo() || "",
+  private_field: get_private_field() || [],
+  roleProcess: get_action_data() || [],
+  currentCompany: getUserCompany() ? getUserCompany().code : '',
+  userInfo: _getUserInfo(),
+  isSupertube: false,
+  companylist:[],
+  originLevel: "0",
+  currentLevel: "0"
+};
+
+const companyTypes = {
+  'business': 'business',
+  'supplier': 'supplier'
+}
+
+const mutations = {
+  SET_TOKEN: (state, token) => {
+    state.token = token;
+  },
+  SET_MENU: (state, menu) => {
+    state.menu = menu;
+  },
+  SET_HAS: (state, has) => {
+    state.has = has;
+  },
+  SET_INTRODUCTION: (state, introduction) => {
+    state.introduction = introduction;
+  },
+  SET_NAME: (state, name) => {
+    state.name = name;
+  },
+  SET_AVATAR: (state, avatar) => {
+    state.avatar = avatar;
+  },
+  SET_ROLES: (state, roles) => {
+    state.roles = roles;
+  },
+  navListFn(state, val) {
+    if (!val) {
+      val = [];
+    }
+    state.navList = val;
+    setMenu(val);
+  },
+  btnListFn(state, val) {
+    if (!val) {
+      val = [];
+    }
+    state.btnList = val;
+    setBtn(val);
+  },
+
+  setSupplier(state,val){
+    state.isSupplier = val
+  },
+  business_company(state, val) {
+    state.business_company = val;
+    set_business_company(val);
+  },
+  business_companyNo(state, val) {
+    state.business_companyNo = val;
+    set_business_companyNo(val);
+  },
+  roleProcess(state, val) {
+    state.roleProcess = val;
+    set_action_data(val);
+  },
+  private_field(state, val) {
+    state.private_field = val;
+    set_private_field(val);
+  },
+
+  setCurrentLevel(state, val){
+    state.currentLevel = val
+  },
+
+  setOriginLevel(state, val){
+    state.originLevel = val
+  },
+
+  setUserInfo(state, info){
+    state.userInfo = info
+    _setUserInfo(info)
+  },
+
+  setCurrentCompany(state, code){
+    //获取当前公司详细信息
+    const company = state.companylist.find(({code: _code}) => _code === code)
+    setUserCompany(company)
+    state.currentCompany = code;
+  },
+
+  setCompanyType(state, code){
+    const isBusiness = code.indexOf('GS') >= 0
+    state.companyType = isBusiness ? companyTypes.business : companyTypes.supplier
+  },
+
+  setCompanylist(state,val){
+    state.companylist = val
+  },
+  setSupertube(state, val) {
+    state.isSupertube = val;
+  }
+}
+
+const actions = {
+  // user login
+  login({ commit }, userInfo) {
+    const { username, password } = userInfo;
+    return new Promise((resolve, reject) => {
+      login({ username: username.trim(), password: password })
+        .then((response) => {
+          const {code, data } = response;
+          if (code === 0) {
+            const {token,nickname}=data
+            commit("SET_TOKEN", token);
+            commit("SET_NAME", nickname);
+            setToken(token);
+          }
+          resolve(response);
+        })
+        .catch((error) => {
+          reject(error);
+        });
+    });
+  },
+
+  dingUserInfor({ commit }, code) {
+    return new Promise(async (resolve, reject) => {
+      dingdingdetail(code)
+        .then((response) => {
+          const { data } = response;
+          if (response.code === 0) {
+            commit("SET_TOKEN", data.token);
+            setToken(data.token);
+            resolve("success");
+          } else {
+            resolve("error");
+          }
+        })
+        .catch((error) => {
+          reject(error);
+        });
+    });
+  },
+
+  async loginByToken({commit, dispatch}, token) {
+    setToken(token)
+    await commit('SET_TOKEN')
+    await dispatch('getMenuList')
+  },
+  async getRoleInfo({commit, that, dispatch}, _current_company_){
+    return new Promise(async resolve => {
+      //查找默认的业务公司 设置到全局的currentCompany
+      const { roleid } = _current_company_;
+
+      //根据角色获取流程节点权限
+      const { pcode, pdata, pmsg } = await getRoleProcess(roleid);
+      if (pcode === 0) {
+        commit("roleProcess", pdata ?? []);
+      }
+      if (pcode >= 100 && pcode <= 104) {
+        resolve("noToken");
+        return
+      }
+      //根据角色获取角色详情 获取关键字字段
+      const {code: rcode, data: rdata, message: rmsg} = await reuqsetRoleInfo({ roleid: roleid })
+
+      if(rcode === 0){
+        commit("private_field", rdata.private_field ? rdata.private_field.split(',') : []);
+      }
+
+      if (rcode >= 100 && rcode <= 104) {
+        resolve("noToken");
+        return
+      }
+    })
+  },
+
+  async getMenuList({ commit, that, dispatch }) {
+    return new Promise(async (resolve) => {
+      if (!getToken()) {
+        resolve("noToken");
+      } else {
+        const { ucode, udata, umsg } = await getUserInfo();
+        if (ucode >= 100 && ucode <= 104) {
+          resolve("noToken");
+        } else if (ucode !== 0) {
+          resolve({ code: ucode, data: udata, massage: umsg })
+        } else {
+          const { level } = udata;
+          //是否超管
+          const isSupertube = level === '1'
+          //是否供应商
+          const isSupplier = level === '3'
+          //保存用户信息
+          commit('setUserInfo', udata)
+          //保存是否超管
+          commit('setSupplier', isSupplier)
+          //保存是否超管用户
+          commit("setSupertube", isSupertube);
+          //设置原始level和当前level
+          commit('setOriginLevel', level)
+          commit('setCurrentLevel', level)
+          //获取公司列表(区分超管和普通账户api)
+          const api = isSupertube ? requsetSupertubeCompany : requsetUserBindingCompany
+          //获取缓存里的业务公司 => 公司名称搜索 => 存在设置为默认公司
+          const { data: companyData, code: companyCode } = await api({
+            ...(!isSupertube ? ({size: 10000}) : {type: '1'}),
+            ...({token: getToken()}),
+          })
+           //保存公司列表 普通用户和超管使用两个列表需要转换
+           let _companylist = []
+           if(companyCode === 0) {
+            _companylist = isSupertube ? companyData.list : convertCompanylist(companyData.list);
+            //超管 + 业务公司 需要将 relation_code 设置为 code
+            // if(isSupertube) _companylist = _companylist.map(item => ({...item, code: item.relation_code}))
+            commit('setCompanylist', _companylist)
+           }
+           if(companyCode >= 100 && companyCode <= 104){
+             resolve("noToken")
+             return
+           }
+
+          //非超管用户获取保存 流程权限 & 关键字字段 & 设置默认业务公司
+          let defaultCompany = ''
+          if(!isSupertube){
+            //查找默认的业务公司 设置到全局的currentCompany
+            defaultCompany =  _companylist.find(({is_main}) => is_main === '1');
+            const result = dispatch('getRoleInfo', defaultCompany)
+            if(result === 'noToken') {
+              resolve('noToken')
+              return
+            }
+          }
+
+          //保存默认公司
+          commit('setCurrentCompany', defaultCompany ? defaultCompany.code : '')
+          const { mcode, mdata, mmsg } = await getRoleMenuList();
+
+          //拦截账号异常: 禁用
+          if(mcode === 10001) {
+            dispatch('disabledCompany');
+            return
+          }
+
+          if (mcode >= 100 && mcode <= 104) {
+            resolve("noToken");
+          } else if (mcode !== 0) {
+            resolve({ code: mcode, data: {}, massage: mmsg });
+          } else {
+            const { arrag, isok, btnList } = mdata;
+            // 生成页面权限
+            commit("navListFn", arrag);
+            // 生成按钮权限
+            commit("btnListFn", btnList);
+            // 生成路由
+            initRouter(arrag, that);
+            resolve(isok ? "success-dataV" : "success");
+          }
+        }
+      }
+    });
+  },
+
+  // user logout
+  logout({ commit, state, dispatch }) {
+    return new Promise((resolve, reject) => {
+      commit("SET_TOKEN", "");
+      commit("SET_ROLES", []);
+      commit("SET_MENU", "");
+      commit("SET_HAS", "");
+      _removeUserInfo()
+      removeBtn();
+      removeMenu();
+      removeToken();
+      remove_business_company();
+      commit("business_company", "");
+      commit("business_companyNo", "");
+      remove_business_companyNo();
+      remove_private_field();
+      commit("private_field", []);
+      remove_action_data();
+      commit("action_data", []);
+      removeUserCompany()
+      commit("action_data", []);
+      // removeMainList()
+      // reset visited views and cached views
+      // to fixed https://github.com/PanJiaChen/vue-element-admin/issues/2485
+      dispatch("tagsView/delAllViews", null, { root: true });
+      resolve();
+    });
+  },
+
+  // remove token
+  resetToken({ commit }) {
+    return new Promise((resolve) => {
+      commit("SET_TOKEN", "");
+      commit("SET_ROLES", []);
+      removeToken();
+      resolve();
+    });
+  },
+};
+async function getUserInfo() {
+  const { code, data, meaasge } = await usergetinfo({
+    token:getToken()
+  });
+
+  return {
+    ucode: code,
+    udata: data,
+    umsg: meaasge,
+  };
+}
+
+async function getRoleProcess(roleid) {
+  const { code, data, meaasge } = await roleProcessInfo({ roleid });
+  let list = data;
+  list.map((si) => {
+    si.action = [];
+    if (si.child && si.child.length > 0) {
+      si.child.map((sii) => {
+        si.action.push(sii.order_process + "");
+        return sii;
+      });
+    }
+    return si;
+  });
+  return {
+    pcode: code,
+    pdata: list,
+    pmsg: meaasge,
+  };
+}
+
+// function isHasRoute(routes){
+//   let isHas = false
+//   const chunks = location.hash.split('/')
+//   const currentPath = chunks[chunks.length - 1]
+
+//   const dfs = (routes) => {
+//     routes.forEach(route => {
+//       if(route.path === currentPath) isHas = true;
+//       if(route.children && route.children.length > 0) dfs(route.children)
+//     })
+//   }
+
+//   dfs([
+//   {
+//     path: "/person",
+//     component: () => import("@/layout/index"),
+//     redirect: "/person/my-message",
+//     hidden: true,
+//     alwaysShow: true,
+//     meta: {
+//       title: "个人中心",
+//       icon: "user",
+//     },
+//     children: [
+//       {
+//         path: "my-message",
+//         component: () => import("@/views/person-infor/my-message"),
+//         name: "MyMessage",
+//         alwaysShow: true,
+//         meta: { title: "我的信息", noCache: true, breadcrumb: true },
+//       },
+//       {
+//         path: "change-phone",
+//         component: () => import("@/views/person-infor/change-phone"),
+//         name: "ChangePhone",
+//         alwaysShow: true,
+//         meta: { title: "更换手机号", noCache: true, breadcrumb: true },
+//       },
+//       {
+//         path: "change-password",
+//         component: () => import("@/views/person-infor/change-password"),
+//         name: "ChangePassword",
+//         alwaysShow: true,
+//         meta: { title: "修改密码", noCache: true, breadcrumb: true },
+//       },
+//       {
+//         path:'/reload',
+//         component:() => import('@/views/reload/index')
+//       }
+//     ],
+//   },
+//   //欢迎页
+//   {
+//     path: "/welcome",
+//     component: () => import("@/layout/index"),
+//     redirect: "/welcome/dashboard",
+//     children: [
+//       {
+//         path: "dashboard",
+//         component: () => import("@/views/dashboard/index"),
+//         name: "Dashboard",
+//         meta: { title: "首页", icon: "dashboard", affix: true },
+//       },
+//     ],
+//   },...routes])
+//   return isHas
+// }
+
+// 区分供应商和业务公司获取不同的菜单列表
+async function getRoleMenuList(level = "") {
+  const { code, data, message } = await menuList({
+    ...(level && level !== '1' ? { level } : {})
+  })
+
+  //menu接受账户异常:禁用 并返回
+  if(message === '账户已禁用' || message === '没有该公司的默认角色'){
+    return {
+      mdata: {},
+      mmsg: '账号被禁用',
+      mcode: 10001
+    }
+  }
+
+  let arrag = [];
+  let btnList = [];
+  let list = [];
+  let isok = false;
+
+  if (code === 0) {
+    list = data ?? [];
+    list = list.filter((item) => item.child && item.child.length > 0);
+    list.forEach((v1) => {
+      const { menu_route, child } = v1;
+      if (menu_route === "bigScreen" && child.length) {
+        isok = true;
+      }
+      let pItem = {
+        name: v1.menu_route,
+        path: `/${v1.menu_route}`,
+        meta: {
+          title: v1.menu_name,
+          icon: v1.menu_img,
+        },
+        children: [],
+      };
+      v1.child.forEach((v2) => {
+        let item = {
+          path: v2.menu_route,
+          name: v2.menu_route,
+          hidden: parseInt(v2.is_private + "") === 0,
+          meta: {
+            title: v2.menu_name,
+            icon: v2.menu_img,
+          },
+          url: v2.menu_url,
+        };
+        let model = {
+          menu_route: v2.menu_route,
+          action: v2.action,
+        };
+        btnList.push(model);
+        pItem.children.push(item);
+      });
+      arrag.push(pItem);
+    });
+  }
+
+  // const isHas = isHasRoute(arrag)
+  // if(!isHas) router.push('/welcome/dashboard')
+
+  return {
+    mcode: code,
+    mdata: {
+      isok,
+      arrag,
+      btnList,
+    },
+    mmsg: message,
+  };
+}
+
+function initRouter(arr) {
+  const IndexRoute = [
+    // 个人信息
+    {
+      path: "/person",
+      component: () => import("@/layout/index"),
+      redirect: "/person/my-message",
+      hidden: true,
+      alwaysShow: true,
+      meta: {
+        title: "个人中心",
+        icon: "user",
+      },
+      children: [
+        {
+          path: "my-message",
+          component: () => import("@/views/person-infor/my-message"),
+          name: "MyMessage",
+          alwaysShow: true,
+          meta: { title: "我的信息", noCache: true, breadcrumb: true },
+        },
+        {
+          path: "change-phone",
+          component: () => import("@/views/person-infor/change-phone"),
+          name: "ChangePhone",
+          alwaysShow: true,
+          meta: { title: "更换手机号", noCache: true, breadcrumb: true },
+        },
+        {
+          path: "change-password",
+          component: () => import("@/views/person-infor/change-password"),
+          name: "ChangePassword",
+          alwaysShow: true,
+          meta: { title: "修改密码", noCache: true, breadcrumb: true },
+        },
+        {
+          path:'/reload',
+          component:() => import('@/views/reload/index')
+        }
+      ],
+    },
+    //欢迎页
+    {
+      path: "/welcome",
+      component: () => import("@/layout/index"),
+      redirect: "/welcome/dashboard",
+      children: [
+        {
+          path: "dashboard",
+          component: () => import("@/views/dashboard/index"),
+          name: "Dashboard",
+          meta: { title: "首页", icon: "dashboard", affix: true },
+        },
+      ],
+    },
+  ];
+
+  arr.map((v1) => {
+    v1.component = (resolve) => require([`@/layout/index.vue`], resolve);
+    if (v1.children && v1.children.length > 0) {
+      v1.redirect = `/${v1.name}/${v1.children[0].name}`;
+      v1.children.map((v2) => {
+        v2.component = (resolve) => require([`@/views/${v2.url}.vue`], resolve);
+        return v2;
+      });
+    }
+    return v1;
+  });
+
+  IndexRoute.push(...arr);
+
+  IndexRoute.push({
+    path: "404",
+    component: () => import("@/views/error-page/404"),
+    hidden: false,
+    noCache: true,
+  });
+
+  IndexRoute.push({
+    path: "*",
+    redirect: "/welcome/dashboard",
+  })
+
+  window.vm.$router.addRoutes(IndexRoute);
+}
+
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions,
+};

+ 47 - 257
src/store/modules/user.js

@@ -6,9 +6,8 @@ import {
   dingdingdetail,
   usergetinfo,
   roleProcessInfo,
-  requsetSupertubeCompany,
-  requsetUserBindingCompany,
-  reuqsetRoleInfo
+  reuqsetRoleInfo,
+  requestMenus
 } from "@/apis/user";
 
 import {
@@ -175,36 +174,20 @@ const mutations = {
 
 const actions = {
   // user login
-  login({ commit }, userInfo) {
+  async login({ commit }, userInfo) {
     const { username, password } = userInfo;
-    return new Promise((resolve, reject) => {
-      login({ username: username.trim(), password: password })
-        .then((response) => {
-          const {code, data } = response;
-          if (code === 0) {
-            const {token,nickname}=data
-            commit("SET_TOKEN", token);
-            commit("SET_NAME", nickname);
-            setToken(token);
-          }
-          resolve(response);
-        })
-        .catch((error) => {
-          reject(error);
-        });
-    });
-  },
-
-  //公司角色异常
-  disabledCompany({commit, that}){
-    commit("navListFn", []);
-    commit("btnListFn", []);
-    initRouter([], that);
-    const company = getUserCompany()
-    MessageBox
-      .alert(`公司 ${company.name} 角色异常或该公司禁用,请检查账号或者角色设置`, '公司角色异常', {type: 'warning', confirmButtonText:'前往首页'})
-      .then(() => {router.push("/reload?redirect=welcome/dashboard")})
-      .catch(() => {router.push("/reload?redirect=welcome/dashboard")})
+    try{
+      const response = await login({username: username.trim(),password})
+      const { code, data } = response
+      if(Number(code) === 1){
+        const { token } = data;
+        commit('SET_TOKEN',token)
+        setToken(token)
+      }
+      return response
+    }catch (err){
+      throw err
+    }
   },
 
   dingUserInfor({ commit }, code) {
@@ -232,41 +215,6 @@ const actions = {
     await dispatch('getMenuList')
   },
 
-
-  // 切换公司后重新请求
-  async reloadMenulist({commit, dispatch ,that, state}, level){
-    return new Promise(async resolve => {
-      const company = getUserCompany()
-       dispatch('getRoleInfo', company)
-       //获取菜单
-       const { mcode, mdata, message: mmsg } = await getRoleMenuList(level);
-
-       //账号禁用
-       if(mcode === 10001){
-        commit("navListFn", []);
-        commit("btnListFn", []);
-        initRouter([], that);
-        resolve('disabled')
-        return
-       }
-
-       if (mcode >= 100 && mcode <= 104) {
-         resolve("noToken");
-       } else if (mcode !== 0) {
-         resolve({ code: mcode, data: {}, massage: mmsg });
-       } else {
-         const { arrag, isok, btnList } = mdata;
-         // 生成页面权限
-         commit("navListFn", arrag);
-         // 生成按钮权限
-         commit("btnListFn", btnList);
-         // 生成路由
-         initRouter(arrag, that);
-         resolve(isok ? "success-dataV" : "success");
-       }
-    })
-  },
-
   async getRoleInfo({commit, that, dispatch}, _current_company_){
     return new Promise(async resolve => {
       //查找默认的业务公司 设置到全局的currentCompany
@@ -297,86 +245,30 @@ const actions = {
 
   async getMenuList({ commit, that, dispatch }) {
     return new Promise(async (resolve) => {
+      const isok = false
       if (!getToken()) {
         resolve("noToken");
       } else {
         const { ucode, udata, umsg } = await getUserInfo();
-        if (ucode >= 100 && ucode <= 104) {
+        if (ucode === 101) {
           resolve("noToken");
-        } else if (ucode !== 0) {
+        } else if (ucode !== 1) {
           resolve({ code: ucode, data: udata, massage: umsg })
         } else {
-          const { level } = udata;
-          //是否超管
-          const isSupertube = level === '1'
-          //是否供应商
-          const isSupplier = level === '3'
-          //保存用户信息
-          commit('setUserInfo', udata)
-          //保存是否超管
-          commit('setSupplier', isSupplier)
-          //保存是否超管用户
-          commit("setSupertube", isSupertube);
-          //设置原始level和当前level
-          commit('setOriginLevel', level)
-          commit('setCurrentLevel', level)
-          //获取公司列表(区分超管和普通账户api)
-          const api = isSupertube ? requsetSupertubeCompany : requsetUserBindingCompany
-          //获取缓存里的业务公司 => 公司名称搜索 => 存在设置为默认公司
-          const { data: companyData, code: companyCode } = await api({
-            ...(!isSupertube ? ({size: 10000}) : {type: '1'}),
-            ...({token: getToken()}),
-          })
-           //保存公司列表 普通用户和超管使用两个列表需要转换
-           let _companylist = []
-           if(companyCode === 0) {
-            _companylist = isSupertube ? companyData.list : convertCompanylist(companyData.list);
-            //超管 + 业务公司 需要将 relation_code 设置为 code
-            // if(isSupertube) _companylist = _companylist.map(item => ({...item, code: item.relation_code}))
-            commit('setCompanylist', _companylist)
-           }
-           if(companyCode >= 100 && companyCode <= 104){
-             resolve("noToken")
-             return
-           }
-           
-          //非超管用户获取保存 流程权限 & 关键字字段 & 设置默认业务公司
-          let defaultCompany = ''
-          if(!isSupertube){
-            //查找默认的业务公司 设置到全局的currentCompany
-            defaultCompany =  _companylist.find(({is_main}) => is_main === '1');
-            const result = dispatch('getRoleInfo', defaultCompany)
-            if(result === 'noToken') {
-              resolve('noToken')
-              return
-            }
-          }
 
-          //保存默认公司
-          commit('setCurrentCompany', defaultCompany ? defaultCompany.code : '')
-          const { mcode, mdata, mmsg } = await getRoleMenuList();
+            console.log(udata)
 
-          //拦截账号异常: 禁用
-          if(mcode === 10001) {
-            dispatch('disabledCompany');
-            return
-          }
-
-          if (mcode >= 100 && mcode <= 104) {
-            resolve("noToken");
-          } else if (mcode !== 0) {
-            resolve({ code: mcode, data: {}, massage: mmsg });
-          } else {
-            const { arrag, isok, btnList } = mdata;
+            const { menus, btnList } = convertMenus(udata.action); // TODO..
+            
+            commit("setUserInfo", udata)
             // 生成页面权限
-            commit("navListFn", arrag);
+            commit("navListFn", menus);
             // 生成按钮权限
-            commit("btnListFn", btnList);
+             commit("btnListFn", btnList);
             // 生成路由
-            initRouter(arrag, that);
+            initRouter(menus, that);
             resolve(isok ? "success-dataV" : "success");
           }
-        }
       }
     });
   },
@@ -420,132 +312,30 @@ const actions = {
     });
   },
 };
+
+
 async function getUserInfo() {
-  const { code, data, meaasge } = await usergetinfo({
+  const { code, data, msg } = await usergetinfo({
     token:getToken()
   });
 
   return {
     ucode: code,
     udata: data,
-    umsg: meaasge,
+    umsg: msg,
   };
 }
 
-async function getRoleProcess(roleid) {
-  const { code, data, meaasge } = await roleProcessInfo({ roleid });
-  let list = data;
-  list.map((si) => {
-    si.action = [];
-    if (si.child && si.child.length > 0) {
-      si.child.map((sii) => {
-        si.action.push(sii.order_process + "");
-        return sii;
-      });
-    }
-    return si;
-  });
-  return {
-    pcode: code,
-    pdata: list,
-    pmsg: meaasge,
-  };
-}
-
-// function isHasRoute(routes){
-//   let isHas = false
-//   const chunks = location.hash.split('/')
-//   const currentPath = chunks[chunks.length - 1]
-
-//   const dfs = (routes) => {
-//     routes.forEach(route => {
-//       if(route.path === currentPath) isHas = true;
-//       if(route.children && route.children.length > 0) dfs(route.children)
-//     })
-//   }
-
-//   dfs([ 
-//   {
-//     path: "/person",
-//     component: () => import("@/layout/index"),
-//     redirect: "/person/my-message",
-//     hidden: true,
-//     alwaysShow: true,
-//     meta: {
-//       title: "个人中心",
-//       icon: "user",
-//     },
-//     children: [
-//       {
-//         path: "my-message",
-//         component: () => import("@/views/person-infor/my-message"),
-//         name: "MyMessage",
-//         alwaysShow: true,
-//         meta: { title: "我的信息", noCache: true, breadcrumb: true },
-//       },
-//       {
-//         path: "change-phone",
-//         component: () => import("@/views/person-infor/change-phone"),
-//         name: "ChangePhone",
-//         alwaysShow: true,
-//         meta: { title: "更换手机号", noCache: true, breadcrumb: true },
-//       },
-//       {
-//         path: "change-password",
-//         component: () => import("@/views/person-infor/change-password"),
-//         name: "ChangePassword",
-//         alwaysShow: true,
-//         meta: { title: "修改密码", noCache: true, breadcrumb: true },
-//       },
-//       {
-//         path:'/reload',
-//         component:() => import('@/views/reload/index')
-//       }
-//     ],
-//   },
-//   //欢迎页
-//   {
-//     path: "/welcome",
-//     component: () => import("@/layout/index"),
-//     redirect: "/welcome/dashboard",
-//     children: [
-//       {
-//         path: "dashboard",
-//         component: () => import("@/views/dashboard/index"),
-//         name: "Dashboard",
-//         meta: { title: "首页", icon: "dashboard", affix: true },
-//       },
-//     ],
-//   },...routes])
-//   return isHas
-// }
-
-// 区分供应商和业务公司获取不同的菜单列表
-async function getRoleMenuList(level = "") {
-  const { code, data, message } = await menuList({
-    ...(level && level !== '1' ? { level } : {})
-  })
-
-  //menu接受账户异常:禁用 并返回
-  if(message === '账户已禁用' || message === '没有该公司的默认角色'){
-    return {
-      mdata: {},
-      mmsg: '账号被禁用',
-      mcode: 10001
-    }
-  }
+function convertMenus(_list){
+  const arrag = []
 
-  let arrag = [];
   let btnList = [];
   let list = [];
-  let isok = false;
-
-  if (code === 0) {
-    list = data ?? [];
-    list = list.filter((item) => item.child && item.child.length > 0);
+    list = _list.filter((item) => item.children && item.children.length > 0);
+    console.log(_list)
     list.forEach((v1) => {
-      const { menu_route, child } = v1;
-      if (menu_route === "bigScreen" && child.length) {
+      const { menu_route, children } = v1;
+      if (menu_route === "bigScreen" && children.length) {
         isok = true;
       }
       let pItem = {
@@ -557,11 +347,11 @@ async function getRoleMenuList(level = "") {
         },
         children: [],
       };
-      v1.child.forEach((v2) => {
+      v1.children.forEach((v2) => {
         let item = {
           path: v2.menu_route,
           name: v2.menu_route,
-          hidden: parseInt(v2.is_display + "") === 0,
+          hidden: parseInt(v2.is_private + "") === 0,
           meta: {
             title: v2.menu_name,
             icon: v2.menu_img,
@@ -575,24 +365,23 @@ async function getRoleMenuList(level = "") {
         btnList.push(model);
         pItem.children.push(item);
       });
+
       arrag.push(pItem);
     });
-  }
 
-  // const isHas = isHasRoute(arrag)
-  // if(!isHas) router.push('/welcome/dashboard')
-  
   return {
-    mcode: code,
-    mdata: {
-      isok,
-      arrag,
+      menus:arrag,
       btnList,
-    },
-    mmsg: message,
   };
 }
 
+
+// async function getRoleMenuList(level = "") {
+//   const { code, data, msg } = await requestMenus({})
+
+  
+// }
+
 function initRouter(arr) {
   const IndexRoute = [
     // 个人信息
@@ -676,6 +465,7 @@ function initRouter(arr) {
     redirect: "/welcome/dashboard",
   })
 
+
   window.vm.$router.addRoutes(IndexRoute);
 }
 

+ 20 - 16
src/views/customerService/demandOrder/components/demandDetail/requsetPerpaymentModal.vue

@@ -1,14 +1,14 @@
 <template>
   <el-dialog :visible="innerVisible" title="申请预付" width="380px" center :close-on-click-modal="false" @close="onClose">
-    <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-position="left" size="mini">
-      <el-form-item label="预付类型" :prop="mapFields.prepaymentType">
-        <el-select style="width:250px" placeholder="预付类型" v-model="ruleForm[mapFields.prepaymentType]">
+    <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-position="left" size="mini" label-width="80px">
+      <el-form-item label="预付类型" prop="prepaymentType">
+        <el-select style="width:100%" placeholder="预付类型" v-model="ruleForm.prepaymentType">
           <el-option />
         </el-select>
       </el-form-item>
 
-      <el-form-item label="支付比例" :prop="mapFields.paymentRatio">
-        <el-select style="width:250px" v-model="ruleForm[mapFields.paymentRatio]" placeholder="支付比例">
+      <el-form-item label="支付比例" prop="paymentRatio">
+        <el-select style="width:100%" v-model="ruleForm.paymentRatio" placeholder="支付比例">
           <el-option />
         </el-select>
       </el-form-item>
@@ -21,12 +21,11 @@
 </template>
 
 <script>
-import { createEmptyStringObject } from '@/utils/static'
-
-const mapFields = {
-  prepaymentType:'prepaymentType', //预付类型
-  paymentRatio:"paymentRatio" //支付比例
-}
+/**
+ * @props
+  prepaymentType  //预付类型
+  paymentRatio  //支付比例
+*/
 
 export default {
   props:['visible'],
@@ -42,15 +41,17 @@ export default {
   },
   data(){
     return {
-      mapFields,
-      ruleForm:createEmptyStringObject(mapFields),
+      ruleForm:{
+          prepaymentType:"",  //预付类型
+          paymentRatio:"" //支付比例
+      },
       rules:{
-        [mapFields.prepaymentType]:[{
+        prepaymentType:[{
           required:true,
           trigger:'change',
           message:'请选择预付类型'
         }],
-        [mapFields.paymentRatio]:[{
+        paymentRatio:[{
           required:true,
           trigger:'change',
           message:'请选择支付比例'
@@ -60,7 +61,10 @@ export default {
   },
   methods:{
     onClose(){
-      this.ruleForm = createEmptyStringObject(mapFields)
+      this.ruleForm = {
+        prepaymentType:"",  //预付类型
+        paymentRatio:"" //支付比例
+      }
       this.innerVisible = false
     },
     async onSubmit(){

+ 24 - 30
src/views/customerService/demandOrder/components/demandDetail/uploadCertificateModal.vue

@@ -1,30 +1,30 @@
 <template>
   <el-dialog :visible="innerVisible" width="500px" title="上传预付付款凭证" center :close-on-click-modal="false" @close="handleClose">
-    <el-form label-position="left" :model="ruleForm" :rules="rules" ref="ruleForm" size="mini">
-      <el-form-item label="预付总金额" :prop="mapFields.prepaymentAmount" style="display:flex">
-        <el-input style="width:350px" placeholder="预付总金额" v-model="ruleForm[mapFields.prepaymentAmount]" />
+    <el-form label-position="left" :model="ruleForm" :rules="rules" ref="ruleForm" size="mini" label-width="95px">
+      <el-form-item label="预付总金额" prop="prepaymentAmount">
+        <el-input placeholder="预付总金额" v-model="ruleForm.prepaymentAmount" />
       </el-form-item>
 
-      <el-form-item label="凭证图片" :prop="mapFields.certificateImage" style="display:flex;">
+      <el-form-item label="凭证图片" prop="certificateImage" label-width="80px">
         <div class="good_info_img_div" style="margin-left:15px">
-          <ul v-if="ruleForm[mapFields.certificateImage]" class="clear">
+          <ul v-if="ruleForm.certificateImage" class="clear">
             <li
               class="img-show-li"
               v-viewer
-              v-for="(img, iindex) in ruleForm[mapFields.certificateImage]"
+              v-for="(img, iindex) in ruleForm.certificateImage"
               :key="img + iindex"
             >
               <div class="img-show-li-div">
                 <img :src="img" class="img-show" alt="" />
                 <i
                   class="el-icon-close"
-                  @click="closeImg(iindex, mapFields.certificateImage)"
+                  @click="closeImg(iindex, 'certificateImage')"
                 ></i>
               </div>
             </li>
             <li
               class="img-show-li"
-              v-if="ruleForm[mapFields.certificateImage].length < 11"
+              v-if="ruleForm.certificateImage.length < 11"
             >
               <div class="activity-upload">
                 <div class="btnupload" style="position: relative">
@@ -35,11 +35,11 @@
                     :accept="'.jpg,.png,.jpeg'"
                     :multiple="true"
                     :uploadcondition="beforeAvatarUpload"
-                    @UploadErrorEvent="UploadErrorEvent($event, mapFields.certificateImage)"
+                    @UploadErrorEvent="UploadErrorEvent($event, 'certificateImage')"
                     @UploadSuccessEvent="
-                      UploadSuccessEvent($event, mapFields.certificateImage)
+                      UploadSuccessEvent($event, 'certificateImage')
                     "
-                  ></file-upload>
+                  />
                 </div>
               </div>
             </li>
@@ -55,12 +55,13 @@
 </template>
 
 <script>
-const mapFields = {
-  //预付总金额
-  prepaymentAmount:'prepaymentAmount',
-  //付款凭证图
-  certificateImage:'certificateImage'
-}
+
+/***
+ *
+  prepaymentAmount //预付总金额
+  certificateImage //付款凭证图
+ */
+
 
 export default {
   props:['visible'],
@@ -76,20 +77,19 @@ export default {
   },
   data(){
     return {
-      mapFields,
       ruleForm:{
-        [mapFields.prepaymentAmount]:"",
-        [mapFields.certificateImage]:[]
+        prepaymentAmount:"", //预付总金额
+        certificateImage:"", //付款凭证图
       },
       rules:{
-         [mapFields.prepaymentAmount]:[
+         prepaymentAmount:[
           {
             required:true,
             trigger:'change',
             message:'请输入预付总金额'
           }
          ],
-        [mapFields.certificateImage]:[
+        certificateImag:[
           {
             required:true,
             trigger:'change',
@@ -102,8 +102,8 @@ export default {
   methods:{
      handleClose(){
       this.ruleForm = {
-        [mapFields.prepaymentAmount]:"",
-        [mapFields.certificateImage]:[]
+        prepaymentAmount: "", //预付总金额
+        certificateImage: ""  //付款凭证图
       }
 
        this.innerVisible = false
@@ -152,12 +152,6 @@ export default {
                 this.$refs.ruleForm.validateField(key);
             }
         },
-        UploadErrorEvent(res, key) {
-            if (res !== "break") {
-                this.$message.error("图片上传失败!");
-                this.$refs.ruleForm.validateField(key);
-            }
-        },
         async onSubmit(){
           try {
             await this.$refs.ruleForm.validate()

+ 17 - 1
src/views/customerService/demandOrder/letterEditing.vue

@@ -1,6 +1,6 @@
 <template>
   <div style="padding:10px">
-    <ul style="margin-bottom:10px;display:flex;justify-content:flex-end;margin-top:10px;align-items:center;">
+    <ul style="width:100%;margin-bottom:10px;display:flex;justify-content:flex-end;margin-top:10px;align-items:center;">
       <li style="line-height:30px;margin-right:20px">
        <span>非税总报价 : </span>
        <span>28000</span>
@@ -16,6 +16,11 @@
        <span>28000</span>
       </li>
 
+
+      <li style="margin-right: 10px">
+        <el-button size="mini" type="primary" @click="downloadTemplate">下载模板</el-button>
+      </li>
+
       <li>
         <el-button size="mini" type="primary">保存</el-button>
       </li>
@@ -41,6 +46,8 @@
 <script>
 import companyHelper from '@/mixins/companyHelper'
 import { MessageBox } from 'element-ui'
+import { template } from "./_template"
+import { utils, writeFile } from "xlsx"
 import dayjs from 'dayjs'
 
 import {
@@ -78,6 +85,15 @@ export default {
     }
   },
   methods: {
+    downloadTemplate(){
+      const workBook = utils.book_new()
+      const workSheet = utils.json_to_sheet(template)
+      utils.book_append_sheet(workBook,workSheet,"sheet")
+
+      writeFile(workBook,"预算函模板.xlsx",{
+        bookType:'xlsx'
+      })
+    },
     validateTableHeader(header, importHeader) {
       let isHeaderOk = true
       if (header.length !== importHeader.length) return false

+ 4 - 1
src/views/customerService/invoiceApproval/columns.js

@@ -8,6 +8,9 @@ const statusList = [
   // 已选完商品,取消议价
 ]
 const listCol = [
+  {
+    type:'selection',
+  },
   {
     prop: 'todo',
     label: '开票申请编号',
@@ -79,6 +82,6 @@ const listCol = [
 ]
 
 export {
-  listCol, 
+  listCol,
   statusList,
 }

+ 83 - 0
src/views/customerService/invoiceApproval/components/approvalModal.vue

@@ -0,0 +1,83 @@
+<template>
+  <el-dialog width="400px" :visible="visible" @close="handleClose" title="批量审批发票" center>
+    <el-form ref="form" :model="formData" size="mini" :rules="rules" label-width="80px">
+      <el-form-item prop="status" label="审批状态">
+        <el-select v-model="formData.status" style="width: 100%" placeholder="审批状态">
+          <el-option label="通过" value="1" />
+          <el-option label="驳回" value="0" />
+        </el-select>
+      </el-form-item>
+
+      <el-form-item label="备注" prop="remark">
+        <el-input v-model="formData.remark" type="textarea" placeholder="备注" />
+      </el-form-item>
+
+      <ElFormItem class="flex-end">
+        <ElButton type="primary" @click="onSubmit">保存</ElButton>
+      </ElFormItem>
+    </el-form>
+  </el-dialog>
+</template>
+
+<script>
+
+const defaultData = {
+  status:'',
+  remark:''
+}
+export default {
+  name: "approvalModal",
+  props:['visible'],
+  data(){
+    return {
+      formData:{...defaultData}
+    }
+  },
+  computed:{
+    rules(){
+      return ({
+        status:[
+          {
+            required:true,
+            trigger:'change',
+            message:'请选择审核状态'
+          }
+        ],
+        remark:[
+          {
+            required: this.formData.status === "0",
+            trigger:'change',
+            message:'请输入备注'
+          }
+        ]
+      })
+    },
+    _visible:{
+      get(){
+        return this.visible
+      },
+      set(newVal){
+        this.$emit('update:visible',newVal)
+      }
+    }
+  },
+  methods:{
+    handleClose(){
+      this._visible = false
+      this.formData = {...defaultData}
+    },
+    async onSubmit(){
+      try{
+        await this.$refs.form.validate()
+        this.$emit("confirm",this.formData)
+      }catch (e) {
+        console.log(e)
+      }
+    }
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

+ 10 - 6
src/views/customerService/invoiceApproval/index.vue

@@ -154,7 +154,7 @@
                   type="warning"
                   class="fr"
                   :size="searchSize"
-                  @click="restSearch"
+                  @click="visible = true"
                 >
                   批量审批发票
                 </el-button>
@@ -181,7 +181,7 @@
                     parmValue.page = 1;
                     searchList();
                   "
-                /> 
+                />
               </el-col>
 
               <el-col :span="4">
@@ -247,6 +247,8 @@
     <div v-else>
       <no-auth></no-auth>
     </div>
+
+    <ApprovalModal :visible.sync="visible" />
   </div>
 </template>
 <script>
@@ -255,6 +257,7 @@ import resToken from "@/mixins/resToken";
 import asyncRequest from "@/apis/service/customerService/invoiceApproval";
 import companyHelper from "@/mixins/companyHelper"
 import { listCol, statusList } from "./columns";
+import ApprovalModal from "./components/approvalModal.vue";
 import { createEmptyStringObject } from '@/utils/static';
 import { mapGetters } from "vuex";
 
@@ -289,6 +292,7 @@ const mapDateFields = {
 export default {
   name: "bargainList",
   mixins: [mixinPage, resToken, companyHelper],
+  components:{ApprovalModal},
   computed: {
     ...mapGetters(["tablebtnSize", "searchSize", "size"]),
     powers() {
@@ -303,6 +307,7 @@ export default {
   data() {
     return {
       mapFields,
+      visible:false,
       customerCode: [], //客户公司code
       statusList,
       sitem: null,
@@ -347,7 +352,7 @@ export default {
       // if(this.parmValue.customer_code.length>0){
       //     this.customerCode = [this.parmValue.customer_code] ;
       // }
-      
+
        this.pageInfo= {
         size: size,
         curr: page,
@@ -383,7 +388,7 @@ export default {
           router: this.$route.path,
         };
         model.preModel = JSON.stringify(routerModel);
-        
+
         this.routeGoto(toRouter, model);
       } else {
         this.$message.warning("暂未找到相关流程!");
@@ -474,7 +479,7 @@ export default {
       this.parmValue.bidsNo = this.select === "2" ? this.s_input : "";
       this.parmValue.infoNo = this.select === "3" ? this.s_input : "";
       this.parmValue.company_name = this.select === "4" ? this.s_input : "";
-      
+
       const res = await asyncRequest.list({
         ...this.parmValue,
         companyNo: this.currentCompany,
@@ -560,4 +565,3 @@ export default {
 .bargainList {
 }
 </style>
-   

+ 16 - 44
src/views/login/index.vue

@@ -133,13 +133,9 @@ export default {
   data() {
     const validateUsername = (rule, value, callback) => {
       if (value === '') {
-        callback(new Error('手机号不能为空!'))
+        callback(new Error('用户名不能为空!'))
       } else {
-        if (!isMobile(value)) {
-          callback(new Error('请输入正确的手机号'))
-        } else {
-          callback()
-        }
+        callback()
       }
     }
     const validatePassword = (rule, value, callback) => {
@@ -179,8 +175,8 @@ export default {
       loginBeian: urlConfig.loginBeian,
       loginBeianUrl: urlConfig.loginBeianUrl,
       loginForm: {
-        username: '',
-        password: '',
+        username: 'admin',
+        password: 'admin123',
         code: ''
       },
       loginRules: {
@@ -189,18 +185,7 @@ export default {
         code: [{ required: true, trigger: 'blur', validator: validateCode }]
       },
       identifyCode: '',
-      identifyCodes: [
-        '0',
-        '1',
-        '2',
-        '3',
-        '4',
-        '5',
-        '6',
-        '7',
-        '8',
-        '9'
-      ],
+      identifyCodes: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
       passwordType: 'password',
       capsTooltip: false,
       loading: false,
@@ -294,30 +279,17 @@ export default {
         ]
       }
     },
-    handleLogin() {
-      this.$refs.loginForm.validate((valid) => {
-        if (valid) {
-          this.loading = true
-          this.$store
-            .dispatch('user/login', this.loginForm)
-            .then((res) => {
-              console.log(res)
-              if (res.code === 0) {
-                this.getMenu()
-              } else {
-                this.$message.warning(res.message)
-                this.loading = false
-              }
-            })
-            .catch((err) => {
-              console.log(err)
-              this.loading = false
-            })
-        } else {
-          console.log('error submit!!')
-          return false
-        }
-      })
+    async handleLogin() {
+       try{
+         await this.$refs.loginForm.validate()
+         const response = await this.$store.dispatch('user/login',this.loginForm)
+         const { code } = response
+         if(Number(code) === 1) this.getMenu()
+         this.loading = false
+       }catch (e){
+         console.log(e)
+         this.loading = false
+       }
     },
     getMenu() {
       this.$store

+ 4 - 1
src/views/platformService/invoice/columns.js

@@ -9,6 +9,9 @@ const statusList = [
 ]
 
 const listCol = [
+    {
+    type:'selection'
+  },
   {
     prop: 'todo',
     label: '开票申请编号',
@@ -89,6 +92,6 @@ const listCol = [
 ]
 
 export {
-  listCol, 
+  listCol,
   statusList
 }

+ 19 - 13
src/views/platformService/invoice/index.vue

@@ -12,6 +12,7 @@
         :size="size"
         @page-curr-change="handlePageChange"
         @page-size-change="handleSizeChange"
+        @selection-change="handleSelectionChange"
         @screen-reset="
           pageInfo.curr = 1;
           parmValue.page = 1;
@@ -41,15 +42,15 @@
                 <el-select v-model="parmValue.supplier" size="mini" placeholder="供应商企业" style="width:100%"
                   @change=" pageInfo.curr = 1;
                            parmValue.page = 1;
-                          searchList();" 
+                          searchList();"
                   />
               </el-col>
 
               <el-col :span="3" style="margin-right:10px">
-                <el-input v-model="parmValue.demandOrderNo" size="mini" placeholder="需求订单编号" style="width:100%" 
+                <el-input v-model="parmValue.demandOrderNo" size="mini" placeholder="需求订单编号" style="width:100%"
                        @change=" pageInfo.curr = 1;
                            parmValue.page = 1;
-                          searchList();" 
+                          searchList();"
                 />
               </el-col>
 
@@ -110,17 +111,17 @@
               </el-col>
 
               <el-col :span="4" style="margin-right:10px">
-                <el-input size="mini" placeholder="发票代码" v-model="parmValue.invoiceCode" 
+                <el-input size="mini" placeholder="发票代码" v-model="parmValue.invoiceCode"
                   @change=" pageInfo.curr = 1;
                            parmValue.page = 1;
                           searchList();"  />
               </el-col>
-       
+
               <el-col :span="4">
                 <el-input size="mini" placeholder="发票号码" v-model="parmValue.invoiceNumber"
                   @change=" pageInfo.curr = 1;
                            parmValue.page = 1;
-                          searchList();" 
+                          searchList();"
                  />
               </el-col>
 
@@ -139,7 +140,7 @@
                   type="warning"
                   class="fr"
                   :size="searchSize"
-                  @click="restSearch"
+                  @click="onExportOpenResult"
                 >
                   批量导出开票结果
                 </el-button>
@@ -151,7 +152,7 @@
                 <el-select v-model="parmValue.invoiceType" size="mini" placeholder="发票类型" style="width:100%"
                   @change=" pageInfo.curr = 1;
                            parmValue.page = 1;
-                          searchList();" 
+                          searchList();"
                   />
               </el-col>
 
@@ -159,7 +160,7 @@
                 <el-input size="mini" placeholder="发票申请编号" v-model="parmValue.invoiceApplyNo"
                   @change=" pageInfo.curr = 1;
                            parmValue.page = 1;
-                          searchList();" 
+                          searchList();"
                  />
               </el-col>
             </el-row>
@@ -203,7 +204,7 @@
           >
             <i
               class="el-icon-view tb-icon"
-              
+
                @click="getRouter('bargainListDetail', scope.row.bargainNo )"
             ></i>
           </el-tooltip>
@@ -255,6 +256,7 @@ export default {
   },
   data() {
     return {
+      selected:[],
       select: "1",
       s_input: "",
       customerCode: [], //客户公司code
@@ -321,8 +323,13 @@ export default {
     }
     this.searchList();
   },
-
   methods: {
+    async onExportOpenResult(){
+      //TODO...
+    },
+    handleSelectionChange({list}) {
+      this.selected = list
+    },
     getRouter(toRouter, queryId){
       if (toRouter && queryId) {
         let model = {
@@ -340,7 +347,7 @@ export default {
           router: this.$route.path,
         };
         model.preModel = JSON.stringify(routerModel);
-        
+
         this.routeGoto(toRouter, model);
       } else {
         this.$message.warning("暂未找到相关流程!");
@@ -502,4 +509,3 @@ export default {
 .bargainList {
 }
 </style>
-   

+ 16 - 9
src/views/serviceParam/Invoicing/addEdit.vue

@@ -26,8 +26,8 @@
             class="demo-ruleForm"
             ><el-row>
               <el-col :span="24">
-                <el-form-item label="发票类型" prop="发票类型属性">
-                  <el-select :disabled="isDetail" placeholder="发票类型" size="mini" style="width:100%" v-model="ruleForm['发票类型属性']">
+                <el-form-item label="抬头类型" prop="titleType">
+                  <el-select :disabled="isDetail" placeholder="发票类型" size="mini" style="width:100%" v-model="ruleForm['titleType']">
                     <el-option />
                   </el-select>
                 </el-form-item>
@@ -36,7 +36,7 @@
                 <el-form-item label="发票抬头" prop="invoice_title">
                   <el-input
                     :disabled="isDetail"
-                    placeholder="发票抬头"
+                    placeholder="抬头类型"
                     maxlength="100"
                     v-model="ruleForm.invoice_title"
                   />
@@ -131,8 +131,16 @@
   </el-dialog>
 </template>
    <script>
+
 import asyncRequest from "@/apis/service/serviceParam/Invoicing";
 import { isLicense, isqzf, isqz, iszf, isz, isMobile } from "@/utils/validate";
+
+/**
+ * @props
+ * titleType 抬头类型
+ * invoice_title 发票抬头
+ * */
+
 export default {
   name: "Invoicing",
   props: ["showModel", "id", "isDetail", "isApproval"],
@@ -248,8 +256,8 @@ export default {
       ruleForm: {},
       rulesThis: this.rules,
       rules: {
-        companyNo: [
-          { required: true, message: "请选择客户公司", trigger: "change" },
+        titleType: [
+          { required: true, message: "请选择抬头类型", trigger: "change" },
         ],
         invoice_title: [
           { required: true, message: "请选择发票抬头", trigger: "change" },
@@ -321,7 +329,7 @@ export default {
           invoice_bankNo,
           invoice_addr,
           invoice_mobile,
-          发票类型属性
+          titleType
         } = data;
         this.companyNoNames = companyName || "";
         this.ruleForm = {
@@ -333,7 +341,7 @@ export default {
           invoice_bankNo: invoice_bankNo || "",
           invoice_addr: invoice_addr || "",
           invoice_mobile: invoice_mobile || "",
-          '发票类型属性':发票类型属性 || ''
+          'titleType':titleType || ''
         };
         this.setTypeM(invoice_mobile);
       } else {
@@ -360,7 +368,7 @@ export default {
         invoice_bankNo: "",
         invoice_addr: "",
         invoice_mobile: "",
-        发票类型属性:''
+        titleType:''
       };
     },
 
@@ -455,4 +463,3 @@ export default {
   }
 }
 </style>
-   

+ 0 - 7
src/views/serviceParam/Invoicing/index.vue

@@ -1,13 +1,9 @@
 <template>
   <div class="Invoicing pagePadding">
     <div
-      v-if=" powers.some((i) => i == '001')"
     >
       <ex-table
         v-loading="loading"
-        v-if="
-           powers.some((i) => i == '001')
-        "
         :table="table"
         :data="tableData"
         :columns="columns"
@@ -249,9 +245,6 @@
         @cancel="showModel = false"
       />
     </div>
-    <div v-else>
-      <no-auth></no-auth>
-    </div>
   </div>
 </template>
 <script>

+ 11 - 6
src/views/serviceParam/demandManagement/addEdit.vue → src/views/serviceParam/demand/addEdit.vue

@@ -20,13 +20,13 @@
             ref="ruleForm"
             :model="ruleForm"
             status-icon
-            :rules="rulesThis"
+            :rules="rules"
             label-width="80px"
             class="demo-ruleForm"
           >
-            <el-form-item label="名称" prop="名称属性">
+            <el-form-item label="名称" prop="name">
               <el-input
-                v-model="ruleForm['名称属性']"
+                v-model="ruleForm['name']"
                 :disabled="id == '007'"
                 placeholder="名称"
                 maxlength="20"
@@ -52,6 +52,11 @@
 <script>
 import asyncRequest from '@/apis/service/serviceParam/industryLabel'
 import resToken from '@/mixins/resToken'
+
+/**
+ * @props
+ * 名称 name
+ * */
 export default {
   name: 'Brand',
   mixins: [resToken],
@@ -70,7 +75,7 @@ export default {
       },
       rulesThis: this.rules,
       rules: {
-        名称属性: [{ required: true, message: '名称不能为空', trigger: 'blur' }]
+        name: [{ required: true, message: '名称不能为空', trigger: 'blur' }]
       }
     }
   },
@@ -102,10 +107,10 @@ export default {
         if (this.$refs.ruleForm) {
           this.$refs.ruleForm.resetFields()
           this.$refs.ruleForm.clearValidate()
-          const { id, 名称 } = this.sitem
+          const { id, name } = this.sitem
           this.ruleForm = {
             id: id || '',
-            unit: 名称 || ''
+            unit: name || ''
           }
         }
       })

+ 0 - 2
src/views/serviceParam/demandManagement/index.vue → src/views/serviceParam/demand/index.vue

@@ -2,7 +2,6 @@
   <div class="unit pagePadding">
     <ex-table
       v-loading="loading"
-      v-if="powers.some((i) => i == '001')"
       :table="table"
       :data="tableData"
       :columns="columns"
@@ -157,7 +156,6 @@
         </el-tooltip>
       </template>
     </ex-table>
-    <no-auth v-else></no-auth>
     <!-- 弹窗 新增/修改 -->
     <add-edit
       :id="modelId"

+ 0 - 0
src/views/serviceParam/demandManagement/需求管理 → src/views/serviceParam/demand/需求管理


+ 0 - 6
src/views/serviceParam/demandProject/index.vue

@@ -2,7 +2,6 @@
   <div class="unit pagePadding">
     <ex-table
       v-loading="loading"
-      v-if="powers.some((i) => i == '001')"
       :table="table"
       :data="tableData"
       :columns="columns"
@@ -157,7 +156,6 @@
         </el-tooltip>
       </template>
     </ex-table>
-    <no-auth v-else></no-auth>
     <!-- 弹窗 新增/修改 -->
     <add-edit
       :id="modelId"
@@ -177,10 +175,6 @@ import mixinPage from "@/mixins/elPaginationHandle";
 import { mapGetters } from "vuex";
 import resToken from "@/mixins/resToken";
 
-const mapFields = {
-  demandProject: 'demandProject', //需求项目
-  status: 'status' //状态
-}
 /**
  * @props
   demandProject //需求项目

+ 3 - 8
src/views/serviceParam/industryManagement/index.vue

@@ -2,7 +2,6 @@
   <div class="unit pagePadding">
     <ex-table
       v-loading="loading"
-      v-if="powers.some((i) => i == '001')"
       :table="table"
       :data="tableData"
       :columns="columns"
@@ -150,7 +149,6 @@
         </el-tooltip>
       </template>
     </ex-table>
-    <no-auth v-else></no-auth>
     <!-- 弹窗 新增/修改 -->
     <add-edit
       :id="modelId"
@@ -171,16 +169,13 @@ import { mapGetters } from "vuex";
 import resToken from "@/mixins/resToken";
 
 /**
- * @props
- *  industry 行业
- *  status 状态
+ *  @param { String } industry 行业
+ *  @param { String } status 状态
 */
 export default {
   name: "industryManagement",
   mixins: [mixinPage, resToken],
-  components: {
-    addEdit,
-  },
+  components: { addEdit },
   computed: {
     //组件SIZE设置
     ...mapGetters(["tablebtnSize", "searchSize", "size"]),

+ 0 - 0
src/views/serviceParam/industryLabel/addEdit.vue → src/views/serviceParam/industryTag/addEdit.vue


+ 1 - 1
src/views/serviceParam/industryLabel/index.vue → src/views/serviceParam/industryTag/index.vue

@@ -190,7 +190,7 @@ export default {
     //组件SIZE设置
     ...mapGetters(["tablebtnSize", "searchSize", "size"]),
     powers() {
-      const tran = this.$store.getters.btnList.find((i) => i.menu_route == "industryLabel") || {};
+      const tran = this.$store.getters.btnList.find((i) => i.menu_route == "industryTag") || {};
       const { action } = tran ?? {};
       return action ?? [];
     },

+ 0 - 0
src/views/serviceParam/industryLabel/行业标签管理 → src/views/serviceParam/industryTag/行业标签管理


+ 357 - 159
src/views/serviceParam/organize/addEdit.vue

@@ -4,235 +4,433 @@
     :title="title"
     :center="true"
     align="left"
-    top="25vh"
+    top="12vh"
     width="600px"
     :close-on-click-modal="false"
     :visible.sync="showModelThis"
+    append-to-body
     element-loading-text="拼命加载中"
     element-loading-spinner="el-icon-loading"
     element-loading-background="rgba(0, 0, 0, 0.8)"
-    append-to-body
     @close="showModelThis = false"
   >
     <el-card style="margin-top: -20px">
-      <el-row>
+      <el-row :gutter="10">
         <el-col :span="24">
           <el-form
             ref="ruleForm"
+            label-position="right"
+            label-width="110px"
             :model="ruleForm"
-            is_show-icon
             :rules="rulesThis"
-            label-width="100px"
-            class="demo-ruleForm"
+            size="mini"
           >
-            <el-form-item label="组织名称:" prop="name">
-              <el-input
-                v-model="ruleForm.name"
-                :disabled="isDetail"
-                 maxlength="50"
-                placeholder="请输入组织名称"
-              />
-            </el-form-item>
+            <el-row>
+              <el-col :span="24">
+                <el-form-item label="组织/企业:" prop="region">
+                  <el-select
+                    v-model="ruleForm.region"
+                    style="width: 100%"
+                    :disabled="isDetail !== '003'"
+                    placeholder="组织/企业"
+                  >
+                    <el-option label="组织" value="0" />
+                    <el-option label="企业" value="1" />
+                  </el-select>
+                </el-form-item>
+              </el-col>
+              <el-col :span="24">
+                <el-form-item label="上级组织">
+                  <el-input
+                    v-model="organName"
+                    disabled
+                    :placeholder="organName ? '上级组织' : '暂无上级组织'"
+                    maxlength="100"
+                  />
+                </el-form-item>
+              </el-col>
+
+              <el-col v-if="ruleForm.region === '0'" :span="24">
+                <el-form-item label="组织名称:" prop="name">
+                  <el-input
+                    style="width:100%"
+                    v-model="ruleForm.name"
+                    :disabled="isDetail === '001'"
+                    placeholder="组织名称"
+                    maxlength="50"
+                  ><template v-if="organName" slot="prepend">{{
+                    organName
+                  }}</template></el-input>
+                </el-form-item>
+              </el-col>
+              <el-col v-if="ruleForm.region === '1'" :span="24">
+                <el-form-item label="企业名称:" prop="companyName">
+                  <el-input
+                    v-model="ruleForm.companyName"
+                    :disabled="isDetail === '001'"
+                    placeholder="企业名称"
+                    maxlength="50"
+                  ><template v-if="organName" slot="prepend">{{
+                    organName
+                  }}</template></el-input>
+                </el-form-item>
+              </el-col>
+              <el-col
+                v-if="ruleForm.region === '1'"
+                :span="24"
+                style="padding: 0 0 16px 0"
+              >
+              </el-col>
+              <el-col :span="24" style="text-align: right">
+                <el-button
+                  v-if="isDetail !== '007'"
+                  size="mini"
+                  type="primary"
+                  @click="submitForm"
+                >保 存
+                </el-button>
+                <el-button size="mini" @click="showModelThis = false">{{
+                  isDetail == "007" ? "关 闭" : "取 消"
+                }}</el-button>
+              </el-col>
+            </el-row>
           </el-form>
         </el-col>
-        <el-col :span="24" style="text-align: right">
-          <el-button v-if="!isDetail" type="primary" @click="submitForm">
-            保 存
-          </el-button>
-          <el-button @click="showModelThis = false">{{
-            isDetail ? "关 闭" : "取 消"
-          }}</el-button>
-        </el-col>
       </el-row>
     </el-card>
   </el-dialog>
 </template>
-
 <script>
+import resToken from '@/mixins/resToken'
 import asyncRequest from "@/apis/service/serviceParam/organize";
-import btnList from "@/assets/js/btnList";
-import resToken from "@/mixins/resToken";
+import contactModal from './contactModal'
 export default {
+  name: 'GoodsBack',
+  components: {
+    contactModal
+  },
   mixins: [resToken],
-  props: [
-    "showModel",
-    "id",
-    "isDetail",
-    "pid",
-    "level",
-    "isAdd",
-    "type",
-    "formData",
-  ],
+  props: ['showModel', 'isDetail', 'id', 'organ', 'kh', "sitem"],
   data() {
+    const validator = function(rule, value, callback) {
+      const isValueValid = Array.isArray(value) && value.length > 0
+      if (!isValueValid && this.area !== '0') {
+        callback(new Error('企业所在区域不能为空'))
+      } else {
+        callback()
+      }
+    }
+
     return {
+      area: '',
+      findex: -1,
+      sitem: null,
+      editModel: false,
       loading: false,
-      showIconModel: false,
-      title: "",
-      btnList,
+      title: '添加企业/组织',
       showModelThis: this.showModel,
       ruleForm: {},
       rulesThis: this.rules,
+      organName: '',
+      tableData: [],
+      old_tableData: [],
+      branch: '',
+      middle: '',
       rules: {
-        name: [
+        region: [
           {
             required: true,
-            message: "请输入组织名称",
-            trigger: "blur",
-          },
+            message: '请选择组织/企业',
+            trigger: 'change'
+          }
+        ],
+        code: [
           {
-            min: 1,
-            max: 50,
-            message: "长度在 1 到 50 个字符",
-            trigger: "blur",
-          },
+            required: true,
+            message: '企业所在区域不能为空',
+            trigger: 'blur',
+            validator: validator.bind(this)
+          }
         ],
-      },
-    };
+        name: [
+          {
+            required: true,
+            message: '组织名称不能为空',
+            trigger: 'blur'
+          }
+        ],
+        companyName: [
+          {
+            required: false,
+            message: '企业名称不能为空',
+            trigger: 'blur'
+          }
+        ]
+      }
+    }
   },
   watch: {
-    showModel: function (val) {
-      this.showModelThis = val;
+    showModel: function(val) {
+      this.showModelThis = val
       if (val) {
-        this.initForm();
+        this.initForm()
       }
     },
     showModelThis(val) {
       if (!val) {
-        this.$emit("cancel");
+        this.$emit('cancel')
       }
     },
+    area(val) {
+      if (val) {
+        this.ruleForm.code = ''
+        this.branch = ''
+        this.middle = ''
+      }
+    },
+    'ruleForm.code': {
+      handler(val) {
+        if (val) this.area = ''
+      },
+      deep: true
+    }
   },
   methods: {
-    
+    handleFreedomAreaChange() {
+      this.$nextTick(() => this.$refs.ruleForm.validateField('code'))
+    },
     async initForm() {
-      if (this.isAdd) {
-        this.title = "添加组织";
-        this.loading = false;
-        this.rulesThis = this.rules;
-       
+      this.loading = true
+      this.tableData = []
+      this.old_tableData = []
+      this.organName = ''
+      await this.resetForm()
+      if (this.isDetail === '003') {
+        this.title = '添加企业/组织'
+        this.rulesThis = this.rules
+      } else if (this.isDetail === '005') {
+        this.title = '修改企业/组织'
+        this.rulesThis = this.rules
+        await this.initData()
       } else {
-        if (this.isDetail) {
-          this.title = "组织详情";
-          this.rulesThis = {};
-        } else {
-          this.title = "修改组织";
-          this.rulesThis = this.rules;
-        }
+        this.title = '查看企业/组织'
+        this.rulesThis = {}
+        await this.initData()
       }
-       await this.resetForm();
+      this.setOrganName()
+      this.loading = false
+    },
+    setOrganName() {
+      this.organName = ''
+      if (this.organ && this.organ.length > 1) {
+        this.organ.forEach((e) => {
+          if (e.id !== '0') {
+            this.organName += e.name
+            this.ruleForm.pid = e.id
+          }
+        })
+      } else {
+        this.organName = ''
+      }
+    },
+    openEdit(index, sitem) {
+      this.findex = index
+      this.sitem = sitem
+      this.editModel = true
+    },
+    openDelete(index) {
+      this.tableData.splice(index, 1)
     },
-
     async resetForm() {
-      this.ruleForm = {
-        id: this.id, 
-        pid: this.pid, 
-        name: this.formData && this.formData.name ? this.formData.name : "", // 名称
-      };
       await this.$nextTick(() => {
         if (this.$refs.ruleForm) {
-          // 去掉验证信息
-          this.$refs.ruleForm.clearValidate();
+          this.$refs.ruleForm.resetFields()
+          this.$refs.ruleForm.clearValidate()
+          this.ruleForm = {
+            id: '',
+            pid: '0',
+            region: '0',
+            name: '',
+            code: [],
+            area: ''
+          }
         }
-      });
+      })
     },
-    async submitForm() {
-      if (this.loading) {
-        return 
-      }
-      this.loading = true;
+    async initData() {
+      console.log(this.sitem)
+      // this.ruleForm = {
+      //   id: id,
+      //   region: this.kh + '' || '0',
+      //   pid: parent || pid || '0',
+      //   name: name || '',
+      //   companyName: companyName || '',
+      //   code: isFreedom || !middle ? [] : [middle],
+      //   area: area ? [area] : []
+      // }
 
-      await this.$refs.ruleForm.validate(async (valid) => {
-        if (valid) {
-          let model = {};
-          let res = {};
-          const { name } = this.ruleForm;
+      const {
+        id,
+        name
+      } = this.sitem
+
+      this.ruleForm = {
+        id: id || "",
+        name: name || "",
+        region: this.kh + '' || '0'
+      }
+    },
+    contactRefresh(e) {
+      this.editModel = false
+      const {
+        index,
+        contactor,
+        commobile,
+        position,
+        comdepart,
+        wxaccount,
+        qqaccount,
+        email,
+        id,
+        is_del
+      } = e
+      if (index + '' === '-1') {
+        this.tableData.push(e)
+      } else {
+        const findex = parseInt(index)
+        this.tableData[findex].contactor = contactor || ''
+        this.tableData[findex].commobile = commobile || ''
+        this.tableData[findex].position = position || ''
+        this.tableData[findex].comdepart = comdepart || ''
+        this.tableData[findex].wxaccount = wxaccount || ''
+        this.tableData[findex].qqaccount = qqaccount || ''
+        this.tableData[findex].email = email || ''
+        this.tableData[findex].id = id || ''
+        this.tableData[findex].is_del = is_del || '0'
+      }
+    },
+    areasearchChange(e) {
+      const { id, city_code, province_code, label } = e
+      this.ruleForm.code = e && id ? [id] : []
+      this.ruleForm.area = e && id ? label : ''
+      this.ruleForm.branch = e && id ? province_code : ''
+      this.ruleForm.middle = e && id ? city_code : ''
 
-          model = {
-            id: this.id,
-            pid: this.pid,
-            name: name,
-          };
+      this.branch = province_code
+      this.middle = city_code
 
-          if (this.level === 1) {
-            // delete model["pid"];
-            // delete model["menuid"];
-            // delete model["url"];
-            // delete model["action_code"];
-            // delete model["status"];
-          } else if (this.level === 2) {
-            delete model["menuid"];
-            delete model["action_code"];
-            delete model["status"];
-          } else {
-            delete model["pid"];
-            delete model["img"];
-            delete model["is_show"];
-            delete model["weight"];
-            delete model["route"];
-            delete model["is_display"];
-            delete model["url"];
-          }
-          if (this.isAdd) {
-            delete model["id"];
+      this.$refs.ruleForm.validateField('code')
+    },
+    async submitForm() {
+      await this.$refs.ruleForm.validate(async(valid) => {
+        if (valid) {
+          if (this.loading) {
+            return
           }
-          if (this.isAdd) {
-            res = await asyncRequest.add(model);
+          this.loading = true
+          const { id, pid, name, code: area_code, area } = this.ruleForm
+          let res = {}
+          if (this.ruleForm.region === '0') {
+            const zitem = {
+              id: id,
+              pid: pid,
+              name: name
+            }
+            if (this.isDetail === '003') {
+              delete zitem['id']
+              res = await asyncRequest.zadd(zitem)
+            } else {
+              res = await asyncRequest.zupdate(zitem)
+            }
           } else {
-            res = await asyncRequest.update(model);
-            // if (this.isAdd) {
-            //   res = await asyncRequest.actionadd(model);
-            // } else {
-            //   res = await asyncRequest.actionedit(model);
-            // }
+            if (this.tableData.length === 0) {
+              this.$message.warning('至少填写一个联系人!')
+              this.loading = false
+              return
+            }
+            const qitem = {
+              id: id,
+              parent: pid,
+              branch: this.area === '0' ? '0' : this.branch,
+              middle: this.area === '0' ? '0' : this.middle,
+              area: this.area === '0' ? '不限区域' : area,
+              customer_member: this.getCustomer()
+            }
+            if (this.isDetail === '003') {
+              delete qitem['id']
+              res = await asyncRequest.qadd(qitem)
+            } else {
+              res = await asyncRequest.qupdate(qitem)
+            }
           }
-          this.loading = false;
-          if (res && res.code === 0) {
-            this.ruleForm = {};
-            const title = this.isAdd ? "添加成功" : "修改成功";
+          this.loading = false
+          const { code } = res
+          if (code === 1) {
+            const title = this.isDetail === '003' ? '添加成功!' : '修改成功!'
             this.$notify.success({
               title,
-              message: "",
-            });
-            this.showModelThis = false;
+              message: ''
+            })
+            this.showModelThis = false
             // 刷新
-            let pids = this.pid;
-            if (this.id === 0) {
-              // 添加组织
-              pids = "0";
-            }
-            this.$emit("refresh", this.id, pids, this.level);
-          } else if (res && res.code >= 100 && res.code <= 104) {
-            await this.logout();
-          } else {
-            this.$message.warning(res.message);
+            this.$emit('refresh')
           }
         } else {
-          this.loading = false;
-          console.log("error submit!!");
-          return false;
+          console.log('error submit!!')
+          return false
         }
-      });
+      })
     },
-  },
-};
-</script>
+    getCustomer() {
+      const list = JSON.parse(JSON.stringify(this.tableData))
+      const oldlist = JSON.parse(JSON.stringify(this.old_tableData))
+      const hasIDlist = []
+      list.forEach((a) => {
+        if (a.id !== '') {
+          hasIDlist.push(a)
+        }
+      })
+      const newList = []
+      const resList = []
+      oldlist.forEach((a, ai) => {
+        let item = null
+        const index = hasIDlist.findIndex((b) => a.id + '' === b.id + '')
+        if (index === -1) {
+          item = JSON.parse(JSON.stringify(a))
+          item.is_del = '1'
+        } else {
+          item = JSON.parse(JSON.stringify(hasIDlist[index]))
+        }
+        newList.push(item)
+      })
+      list.forEach((b) => {
+        if (b.id === '') {
+          b.is_del = '0'
+          newList.push(b)
+        }
+      })
+      newList.forEach((a) => {
+        const m = {
+          id: a.id,
+          contactor: a.contactor,
+          position: a.position,
+          commobile: a.commobile,
+          comdepart: a.comdepart,
+          wxaccount: a.wxaccount,
+          qqaccount: a.qqaccount,
+          email: a.email,
+          is_del: a.is_del || '0',
+          status: a.status || '1'
+        }
+        resList.push(m)
+      })
 
-<style lang="scss" scoped>
-.g-block {
-  display: inline-block;
-  padding: 10px 5px;
-  text-align: center;
-  border: 1px #ccc dashed;
-  margin: 1px;
-  font-size: 0px;
-  cursor: pointer;
-  i {
-    font-size: 30px;
-    line-height: 30px;
-    display: block;
-    margin: 0 auto;
-    width: 30px;
+      return resList
+    }
   }
 }
+</script>
+
+<style lang="scss" scoped>
+.storeAnomaly {}
 </style>

+ 300 - 0
src/views/serviceParam/organize/contactModal.vue

@@ -0,0 +1,300 @@
+<template>
+  <el-dialog
+    :title="title"
+    :center="true"
+    align="left"
+    top="12vh"
+    width="900px"
+    @close="showModelThis = false"
+    :close-on-click-modal="false"
+    :visible.sync="showModelThis"
+    v-loading="loading"
+    append-to-body
+    element-loading-text="拼命加载中"
+    element-loading-spinner="el-icon-loading"
+    element-loading-background="rgba(0, 0, 0, 0.8)"
+  >
+    <el-card style="margin-top: -20px">
+      <el-row :gutter="10">
+        <el-col :span="24">
+          <el-form
+            label-position="right"
+            label-width="90px"
+            :model="ruleForm"
+            :rules="rulesThis"
+            ref="ruleForm"
+          >
+            <el-row>
+              <el-col :span="12">
+                <el-form-item label="联系人:" prop="contactor">
+                  <el-input
+                    v-model="ruleForm.contactor"
+                    placeholder="联系人"
+                    maxlength="100"
+                  />
+                </el-form-item>
+              </el-col>
+              <el-col :span="12">
+                <el-form-item label="电话:" prop="commobile">
+                  <el-input
+                    v-model="ruleForm.commobile"
+                    placeholder="电话"
+                    maxlength="11"
+                  />
+                </el-form-item>
+              </el-col>
+
+              <el-col :span="12">
+                <el-form-item label="职位:" prop="position">
+                  <el-input
+                    v-model="ruleForm.position"
+                    placeholder="职位"
+                    maxlength="100"
+                  />
+                </el-form-item>
+              </el-col>
+              <el-col :span="12">
+                <el-form-item label="部门:" prop="comdepart">
+                  <el-input
+                    v-model="ruleForm.comdepart"
+                    placeholder="部门"
+                    maxlength="100"
+                  />
+                </el-form-item>
+              </el-col>
+
+              <el-col :span="12">
+                <el-form-item label="微信号:" prop="wxaccount">
+                  <el-input
+                    v-model="ruleForm.wxaccount"
+                    placeholder="微信号"
+                    maxlength="100"
+                  />
+                </el-form-item>
+              </el-col>
+              <el-col :span="12">
+                <el-form-item label="QQ:" prop="qqaccount">
+                  <el-input
+                    v-model="ruleForm.qqaccount"
+                    placeholder="QQ"
+                    maxlength="100"
+                  />
+                </el-form-item>
+              </el-col>
+              <el-col :span="12">
+                <el-form-item label="邮箱:" prop="email">
+                  <el-input v-model="ruleForm.email" placeholder="邮箱" maxlength="100" />
+                </el-form-item>
+              </el-col>
+              <el-col :span="12" style="text-align: right">
+                <el-button type="primary" @click="submitForm">保 存 </el-button>
+                <el-button @click="showModelThis = false">{{
+                  id == "007" ? "关 闭" : "取 消"
+                }}</el-button>
+              </el-col>
+            </el-row>
+          </el-form>
+        </el-col>
+      </el-row>
+    </el-card>
+  </el-dialog>
+</template>
+<script>
+import { isWeixin, isMobile, validEmail, isQQ } from "@/utils/validate";
+export default {
+  name: "goodsBack",
+  props: ["showModel", "index", "sitem"],
+  data() {
+    const validateEmail = (rule, value, callback) => {
+      if (value === "") {
+        callback();
+      } else {
+        if (!validEmail(value)) {
+          callback(new Error("邮箱格式不正确!"));
+        } else {
+          callback();
+        }
+      }
+    };
+    const validatemobile = (rule, value, callback) => {
+      if (value === "") {
+        callback(new Error("电话不能为空!"));
+      } else {
+        if (!isMobile(value)) {
+          callback(new Error("电话格式不正确!"));
+        } else {
+          callback();
+        }
+      }
+    };
+
+    const validateWX = (rule, value, callback) => {
+      if (value === "") {
+        callback();
+      } else {
+        if (!isWeixin(value)) {
+          callback(new Error("微信号格式不正确!"));
+        } else {
+          callback();
+        }
+      }
+    };
+    const validateQQ = (rule, value, callback) => {
+      if (value === "") {
+        callback();
+      } else {
+        console.log(value);
+        if (!isQQ(value)) {
+          callback(new Error("QQ号格式不正确!"));
+        } else {
+          callback();
+        }
+      }
+    };
+    return {
+      loading: false,
+      title: "添加联系人",
+      showModelThis: this.showModel,
+      ruleForm: {},
+      rulesThis: this.rules,
+      organName: "",
+      rules: {
+        contactor: [
+          {
+            required: true,
+            message: "联系人不能为空!",
+            trigger: "change",
+          },
+        ],
+        position: [
+          {
+            required: true,
+            message: "职位不能为空",
+            trigger: "blur",
+          },
+        ],
+        comdepart: [
+          {
+            required: true,
+            message: "部门不能为空",
+            trigger: "blur",
+          },
+        ],
+        commobile: [
+          {
+            required: true,
+            validator: validatemobile,
+            trigger: "blur",
+          },
+        ],
+        wxaccount: [
+          {
+            required: false,
+            validator: validateWX,
+            trigger: "blur",
+          },
+        ],
+        qqaccount: [
+          {
+            required: false,
+            validator: validateQQ,
+            trigger: "blur",
+          },
+        ],
+        email: [
+          {
+            required: false,
+            validator: validateEmail,
+            trigger: "blur",
+          },
+        ],
+      },
+    };
+  },
+  watch: {
+    showModel: function (val) {
+      this.showModelThis = val;
+      if (val) {
+        this.initForm();
+      }
+    },
+    showModelThis(val) {
+      if (!val) {
+        this.$emit("cancel");
+      }
+    },
+  },
+  methods: {
+    async initForm() {
+      this.loading = true;
+      console.log(this.index);
+      console.log(this.sitem);
+      this.resetFormData();
+      this.rulesThis = this.rules;
+      if (this.index + "" === "-1") {
+        this.title = "添加联系人";
+      } else {
+        this.title = "修改联系人";
+      }
+      await this.resetForm();
+      this.loading = false;
+    },
+    async resetForm() {
+      await this.$nextTick(() => {
+        if (this.$refs.ruleForm) {
+          this.$refs.ruleForm.resetFields();
+          this.$refs.ruleForm.clearValidate();
+          this.resetFormData();
+        }
+      });
+    },
+    resetFormData() {
+      const {
+        id,
+        contactor,
+        is_del,
+        commobile,
+        position,
+        wxaccount,
+        qqaccount,
+        email,
+        comdepart,
+        status,
+      } = this.sitem;
+      this.ruleForm = {
+        id: id || "",
+        index: this.index || -1,
+        contactor: contactor || "",
+        position: position || "",
+        wxaccount: wxaccount || "",
+        qqaccount: qqaccount || "",
+        email: email || "",
+        comdepart: comdepart || "",
+        status: status || "",
+        is_del: is_del || "0",
+        commobile: commobile || "",
+      };
+    },
+    async submitForm() {
+      await this.$refs.ruleForm.validate(async (valid) => {
+        if (valid) {
+          this.showModelThis = false;
+          let item = JSON.parse(JSON.stringify(this.ruleForm));
+          item.index = this.index;
+          // 刷新
+          this.$emit("refresh", item);
+        } else {
+          console.log("error submit!!");
+          return false;
+        }
+      });
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.storeAnomaly {
+  // width: calc( 100% - 110px);
+}
+</style>

+ 341 - 350
src/views/serviceParam/organize/index.vue

@@ -1,152 +1,248 @@
 <template>
-  <div class="organize pagePadding">
-    <div
-      v-loading="loading"
-      v-if=" powers.some((i) => i == '001')"
-    >
-      <el-row>
-        <el-col :span="24">
-          <el-col :span="24" style="padding: 12px 0 15px 0">
-            <div class="my-breadcrumb clear">
-              <div
-                class="my-breadcrumb-item"
-                v-for="(item, index) in titleList"
-                :key="item + index"
-                :class="{ chover: true }"
-                @click="changeBreadcrumb(index)"
-              >
-                <span class="label">{{ item.titleName }}</span
-                ><span class="separator" v-if="index + 1 !== titleList.length"
-                  >/</span
-                >
-              </div>
-            </div>
-          </el-col>
-          <el-col :span="24">
-            <el-row style="padding: 0 0 3px 0">
-              <el-col :span="8" style="width: 200px">
-                <el-input
-                  placeholder="部门名称"
-                  :size="searchSize"
-                   maxlength="50"
-                  v-model="parmValue.name"
-                >
-                </el-input>
-              </el-col>
-              <el-col :span="8" style="width: 250px; padding: 0 0 0 10px">
-                <el-input
-                  placeholder="员工姓名"
-                  :size="searchSize"
-                   maxlength="50"
-                  v-model="parmValue.nickname"
-                >
-                  <el-button
-                    slot="append"
-                    icon="el-icon-search"
-                    @click="searchList"
-                  ></el-button>
-                </el-input>
-              </el-col>
-
-              <el-col :span="3" style="width: 195px; float: right">
-                <el-button
-                  type="primary"
-                  :size="searchSize"
-                  style="float: right; margin-left: 5px"
-                  @click="searchList"
-                  plain
-                >
-                  刷新
-                </el-button>
-                <el-button
-                  v-if="powers.some((i) => i == '003')"
-                  type="success"
-                  :size="searchSize"
-                  style="float: right"
-                  plain
-                  @click="
-                    addEditFn(
-                      0,
-                      parmValue && parmValue.pid !== '' ? parmValue.pid : '0',
-                      1,
-                      false,
-                      true,
-                      {}
-                    )
-                  "
-                >
-                  添加
-                </el-button>
-              </el-col>
-            </el-row>
-          </el-col>
-        </el-col>
+  <div class="business pagePadding">
+    <div>
+      <el-row style="padding: 5px 0 0 0" v-if="titleList.length > 0">
+        <div class="my-breadcrumb clear">
+          <div
+            class="my-breadcrumb-item"
+            v-for="(item, index) in titleList"
+            :key="item + index"
+            @click="changeBreadcrumb(index)"
+          >
+            <span class="label">{{ item.name }}</span
+            ><span class="separator" v-if="index + 1 !== titleList.length"
+              >/</span
+            >
+          </div>
+          <el-button
+            :size="searchSize"
+            type="primary"
+            style="float: right; margin: 4px 0 0 10px"
+            @click="searchList"
+          >
+            刷新
+          </el-button>
+          <el-button
+            type="warning"
+            class="fr"
+            style="margin: 4px 0 0 10px"
+            :size="searchSize"
+            @click="restSearch"
+          >
+            重置
+          </el-button>
+        </div>
       </el-row>
+      <el-row style="padding: 7px 0 10px 0">
+        <el-col :span="6" style="width: 303px">
+          <period-date-picker
+            :type="1"
+            :width="'135px'"
+            :size="searchSize"
+            :start="parmValue.start"
+            :end="parmValue.end"
+            @timeReturned="handleTime"
+          />
+        </el-col>
+        <el-col :span="3" style="width: 400px">
+          <el-input
+            v-model="sinput"
+            :size="searchSize"
+            clearable
+            @blur="searchList()"
+            placeholder="关键字"
+            maxlength="40"
+          >
+            <el-select
+              v-model="select"
+              slot="prepend"
+              style="width: 125px"
+              placeholder="关键字类型"
+            >
+              <el-option label="组织/企业名称" value="1"></el-option>
+              <el-option label="企业编号" value="2"></el-option>
+              <el-option label="创建人" value="3"></el-option>
+              <el-option label="创建人部门" value="4"></el-option>
+            </el-select>
+            <el-button
+              slot="append"
+              icon="el-icon-search"
+              @click="searchList()"
+            ></el-button
+          ></el-input>
+        </el-col>
 
-      <el-row :gutter="10">
         <el-col
-          :span="24"
-          v-if="
-             powers.some((i) => i == '001')
-          "
+          :span="3"
+          class="fr"
+          style="width: 66px; padding: 0 0 0 10px"
+          v-if="powers.some((i) => i == '002')"
         >
-          <organize-tree
-            style="margin-left: -5px"
-            :list="depart"
-            :level="1"
-            :pid="0"
-            @addEdit="addEditFn"
-            @openChildren="openChildren"
-            @status="setstatus"
-            @del="del"
-          />
-          <staff-tree
-            style="margin-left: -5px"
-            :list="item"
-            :level="1"
-            :pid="0"
-            @setUpEdit="setUpEdit"
-          />
+          <el-button
+            :size="searchSize"
+            type="success"
+            style="float: right"
+            @click="openModal({ id: 'add' }, '003', '0', {})"
+          >
+            添加
+          </el-button>
         </el-col>
-        <div
-          class="no-data"
-          v-if="item && item.length === 0 && depart && depart.length === 0"
-        >
-          暂无数据
-        </div>
       </el-row>
+      <el-table
+        v-loading="loading"
+        :data="tableData"
+        :size="size"
+        border
+        style="width: 100%"
+      >
+        <el-table-column prop="id" label="ID" min-width="100"> </el-table-column>
+        <el-table-column label="类型" min-width="100">
+          <template slot-scope="scope">
+            <el-tag
+              :size="tablebtnSize"
+              :type="scope.row.kh == 0 ? 'success' : ''"
+              v-text="
+                (khOptions.find((item) => item.id == scope.row.kh) || {})
+                  .label || '--'
+              "
+            ></el-tag>
+          </template>
+        </el-table-column>
+        <el-table-column prop="name" label="名称" show-overflow-tooltip>
+        </el-table-column>
+        <el-table-column label="状态" min-width="100">
+          <template slot-scope="scope">
+            <el-tag
+              :size="tablebtnSize"
+              :type="scope.row.status + '' === '0' ? 'warning' : ''"
+              v-text="
+                (
+                  statusOptions.find((item) => item.id == scope.row.status) ||
+                  {}
+                ).label || '--'
+              "
+            ></el-tag>
+          </template>
+        </el-table-column>
+        <el-table-column
+          prop="creater"
+          label="创建人"
+          width="80"
+          show-overflow-tooltip
+        >
+        </el-table-column>
+        <el-table-column
+          prop="addtime"
+          label="创建时间"
+          width="145"
+          show-overflow-tooltip
+        >
+        </el-table-column>
+        <el-table-column fixed="right" label="操作" width="170">
+          <template slot-scope="scope">
+            <el-tooltip
+              effect="dark"
+              v-if="powers.some((i) => i == '001')"
+              content="查看信息"
+              placement="top"
+            >
+              <i
+                class="el-icon-view tb-icon"
+                @click="openModal(scope.row, '001', scope.row.kh,scope.row)"
+              ></i>
+            </el-tooltip>
+            <el-tooltip
+              v-if="powers.some((i) => i == '005')"
+              effect="dark"
+              content="编辑信息"
+              placement="top"
+            >
+              <i
+                class="el-icon-edit tb-icon"
+                @click="openModal(scope.row, '005', scope.row.kh,scope.row)"
+              ></i>
+            </el-tooltip>
+            <el-tooltip
+              v-if="
+                powers.some((i) => i == '004') && scope.row.status + '' === '1'
+              "
+              effect="dark"
+              content="禁用"
+              placement="top"
+            >
+              <i
+                class="el-icon-video-pause tb-icon"
+                @click="
+                  changeStatus(scope.row.id, scope.row.status, scope.row.kh)
+                "
+              ></i>
+            </el-tooltip>
+            <el-tooltip
+              v-if="
+                powers.some((i) => i == '003') && scope.row.status + '' === '0'
+              "
+              effect="dark"
+              content="启用"
+              placement="top"
+            >
+              <i
+                class="el-icon-video-play tb-icon"
+                @click="
+                  changeStatus(scope.row.id, scope.row.status, scope.row.kh)
+                "
+              ></i>
+            </el-tooltip>
+            <el-tooltip
+              v-if="powers.some((i) => i == '006')"
+              effect="dark"
+              content="删除"
+              placement="top"
+            >
+              <i
+                class="el-icon-delete tb-icon"
+                @click="deleteItem(scope.row.id, scope.row.kh)"
+              ></i>
+            </el-tooltip>
+            <el-tooltip
+              effect="dark"
+              v-if="scope.row.kh + '' === '0'"
+              content="查询下一级"
+              placement="top"
+            >
+              <i
+                class="el-icon-caret-right tb-icon"
+                @click="getNext(scope.$index)"
+              ></i>
+            </el-tooltip>
+          </template>
+        </el-table-column>
+      </el-table>
 
       <add-edit
+        :showModel="showModel"
         :id="modelId"
-        :show-model="showModel"
-        :level="level"
-        :pid="parentIds"
-        :is-add="isAdd"
-        :form-data="formData"
-        :type="parmValue.type"
+        :sitem="sitem"
+        :organ="titleList"
+        :kh="kh"
         :is-detail="isDetail"
         @refresh="searchList"
         @cancel="showModel = false"
-      />
-    </div>
-    <div v-else>
-      <no-auth></no-auth>
+      ></add-edit>
     </div>
   </div>
 </template>
-<script>
-import mixinPage from "@/mixins/elPaginationHandle";
+   <script>
+import resToken from "@/mixins/resToken";
 import asyncRequest from "@/apis/service/serviceParam/organize";
 import addEdit from "./addEdit";
-import {statusList} from "@/assets/js/statusList";
 import { mapGetters } from "vuex";
-import resToken from "@/mixins/resToken";
+
 export default {
   name: "organize",
+  mixins: [resToken],
   components: {
     addEdit,
   },
-  mixins: [mixinPage, resToken],
   computed: {
     ...mapGetters(["tablebtnSize", "searchSize", "size"]),
     powers() {
@@ -160,55 +256,71 @@ export default {
   },
   data() {
     return {
+      kh: "",
+      select: "1",
+      sinput: "",
+      // 状态
+      statusOptions: [
+        { id: "0", label: "禁用" },
+        { id: "1", label: "启用" },
+      ],
+      khOptions: [
+        { id: 0, label: "组织" },
+        { id: 1, label: "企业" },
+      ],
       titleList: [],
-      sitem: null,
-      statusList: statusList,
+      isDetail: false,
+      modelId: "",
       loading: true,
       showModel: false,
-      showInterface: false,
-      isDetail: false,
-      isAdd: true,
-      level: 1,
-      modelId: 0,
-      formData: {},
-      parentIds: "",
+      sitem:{},
       parmValue: {
-        pid: "", //父级部门ID
-        name: "", // 部门/公司名称
-        nickname: "", // 员工名称
+        name: "",
+        pid: "",
+        creater: "",
+        start: "",
+        company_name: "", //创建人部门
+        end: "",
+        companyNo: "",
       },
-      depart: [],
-      item: [],
-      passwordModel: false,
-      passwordModelId: 0,
       // 表格 - 数据
-      // depart: [],
+      tableData: [],
     };
   },
   mounted() {
+    this.initTitleList();
     this.searchList();
   },
   methods: {
-    restSearch() {
-      this.parmValue = {
-        pid: "", //父级部门ID
-        name: "", // 部门/公司名称
-        nickname: "", // 员工名称
-      };
-      this.searchList();
+    openModal(row, type, kh, sitem) {
+      const { status, id, code } = row;
+      if (type === "005" && status + '' === "1") {
+        this.$message.warning("禁用后,才可以修改!");
+        return;
+      }
+
+      this.sitem = sitem;
+      this.modelId = kh + "" === "0" ? id : code;
+      this.kh = kh;
+      this.isDetail = type;
+      this.showModel = true;
+    },
+    initTitleList() {
+      this.titleList = [];
+      let model = { id: "0", name: "全部一级组织" };
+      this.titleList.push(model);
+    },
+    // 时间
+    async handleTime(e) {
+      this.parmValue.start = e.startTime || "";
+      this.parmValue.end = e.endTime || "";
+      if (
+        (this.parmValue.start !== "" && this.parmValue.end !== "") ||
+        (this.parmValue.start === "" && this.parmValue.end === "")
+      ) {
+        await this.searchList();
+      }
     },
-    // 原来
-    // async changeBreadcrumb(index) {
-    //   if (index + 1 !== this.titleList.length) {
-    //     this.parmValue.pid = this.titleList[index].id;
-    //     this.titleList = this.titleList.slice(0, index + 1);
-    //   } else {
-    //     this.parmValue.pid = 0;
-    //     this.titleList = [];
-    //   }
-    //   await this.searchList();
-    // },
-    // 修改后
     async changeBreadcrumb(index) {
       if (index + 1 === this.titleList.length) {
         return;
@@ -216,165 +328,67 @@ export default {
         this.parmValue.pid = this.titleList[index].id;
         this.titleList = this.titleList.slice(0, index + 1);
       }
-      if (this.titleList.length === 1) {
-        this.titleList = [];
-      }
-
       await this.searchList();
     },
-    // 原来
-    // async openChildren(item) {
-    //   this.parmValue.pid = item.id;
-    //   let model = {
-    //     id: item.id,
-    //     titleName: item.name,
-    //   };
-    //   this.titleList.push(model);
-    //   await this.searchList();
-    // },
-    // 修改后
-    async openChildren(item) {
-      this.parmValue.pid = item.id;
-      let model = {
-        id: item.id,
-        titleName: item.name,
+    restSearch() {
+      // this.titleList = [];
+      this.parmValue = {
+        name: "",
+        pid: "",
+        creater: "",
+        company_name: "", //创建人部门
+        start: "",
+        end: "",
+        companyNo: "",
       };
-      if (this.titleList.length === 0) {
-        this.titleList.push({ id: "", titleName: "全部分类" });
-      }
-      this.titleList.push(model);
-      await this.searchList();
-    },
-    openModal(id, isDetail, sitem) {
-      this.showModel = true;
-      this.modelId = id;
-      this.isDetail = isDetail;
-      this.sitem = sitem;
-    },
-    openPasswordModal(id, isDetail) {
-      this.passwordModel = true;
-      this.passwordModelId = id;
-      this.isPasswordDetail = isDetail;
-    },
-    async setUpEdit(id, position) {
-      if (position === "1") {
-        const model = {
-          id: id,
-          position: "2",
-        };
-        let res = await asyncRequest.userp(model);
-        if (res && res.code === 0) {
-          this.$notify.success({
-            title: "设置成功!",
-            message: "",
-          });
-          await this.searchList();
-        } else if (res && res.code >= 100 && res.code <= 104) {
-          await this.logout();
-        } else {
-          this.$message.warning(res.message);
-        }
-      } else {
-        this.$message.warning("该账户已是部门负责人!");
-      }
+      this.select = "1";
+      this.sinput = "";
+      this.searchList();
     },
-    addEditFn(id, pid, level, isDetail, isAdd, formData) {
-      this.showModel = true;
-      this.modelId = id;
-      this.level = level;
-      this.parentIds = pid;
-      this.isDetail = isDetail;
-      this.isAdd = isAdd;
-      this.formData = formData;
+    getNext(index) {
+      this.titleList.push(this.tableData[index]);
+      this.parmValue.pid = this.tableData[index].id;
+      this.parmValue.name = "";
+      this.searchList();
     },
-
-    async setstatus(id, parentIds, level, status) {
-      console.log(
-        `openChildren-id, parentIds, level:${id}-${parentIds}-${level}-${status}`
-      );
-      await this.$confirm(`确定要${status === "0" ? "启用" : "禁用"}?`, {
+    /**
+     * 启用/禁用
+     * @param {String} id id
+     * @param {String} status 0-禁用 1-启用
+     * @param {String} tyep 0-组织 1-企业
+     */
+    async changeStatus(id, status, type) {
+      await this.$confirm(`确定要改为${status + '' === "1" ? "禁用" : "启用"}?`, {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
         type: "warning",
       })
         .then(async () => {
+          this.loading = true;
           const model = {
             id: id,
-            status: status === "1" ? "0" : "1",
+            status: status + '' === "1" ? "0" : "1",
           };
-          let res = await asyncRequest.status(model);
-
-          if (res && res.code === 0) {
-            this.$notify.success({
-              title: "修改成功!",
-              message: "",
-            });
-            await this.searchList();
-          } else if (res && res.code >= 100 && res.code <= 104) {
-            await this.logout();
+          let res = {};
+          if (type + "" === "0") {
+            res = await asyncRequest.zstatus(model);
           } else {
-            this.$message.warning(res.message);
+            res = await asyncRequest.qstatus(model);
           }
-        })
-        .catch(() => {
-          console.log("取消");
-        });
-    },
-
-    async del(id, parentIds, level, status) {
-      console.log(
-        `openChildren-id, parentIds, level:${id}-${parentIds}-${level}-${status}`
-      );
-      await this.$confirm(`确定要删除?`, {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning",
-      })
-        .then(async () => {
-          const model = {
-            id: id,
-          };
-          let res = await asyncRequest.delete(model);
-
-          if (res && res.code === 0) {
+          if (res && res.code === 1) {
+            this.loading = false;
             this.$notify.success({
-              title: "删除成功!",
+              title: "状态修改成功!",
               message: "",
             });
             await this.searchList();
-          } else if (res && res.code >= 100 && res.code <= 104) {
-            await this.logout();
           }
         })
         .catch(() => {
           console.log("取消");
         });
     },
-
-    async concatData(id, parentIds, level) {
-      this.loading = true;
-      const res = await asyncRequest.list({});
-      let depart = [];
-      if (res && res.code === 0 && res.data) {
-        depart = res.data;
-      } else if (res && res.code >= 100 && res.code <= 104) {
-        await this.logout();
-      } else {
-        this.$message.warning(res.message);
-      }
-      let arr = JSON.parse(JSON.stringify(this.depart));
-      // if (level === 1) {
-      arr = arr.map((val, index) => {
-        if (level === 1 ? id : parentIds === val.id) {
-          val.child = depart[index].child;
-        }
-        return val;
-      });
-
-      this.depart = arr;
-      this.loading = false;
-    },
-    async deleteById(id, status) {
+    async deleteItem(id, type) {
       await this.$confirm("确定要删除?", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
@@ -383,9 +397,13 @@ export default {
         .then(async () => {
           const model = {
             id: id,
-            status: status === "1" ? "0" : "1",
           };
-          const res = await asyncRequest.status(model);
+          let res = {};
+          if (type + "" === "0") {
+            res = await asyncRequest.zdelete(model);
+          } else {
+            res = await asyncRequest.qdelete(model);
+          }
           if (res && res.code === 0) {
             this.$notify.success({
               title: "删除成功",
@@ -403,71 +421,34 @@ export default {
         });
     },
     async searchList() {
+      if (
+        (this.parmValue.start !== "" && this.parmValue.end === "") ||
+        (this.parmValue.start == "" && this.parmValue.end != "")
+      ) {
+        this.$message.warning("开始时间和结束时间不能为空");
+        return;
+      }
       this.loading = true;
+
       const res = await asyncRequest.list(this.parmValue);
-      if (res && res.code === 0 && res.data) {
-        const { depart, item } = res.data;
-        this.depart = depart;
-        this.item = item;
-      } else if (res && res.code >= 100 && res.code <= 104) {
-        await this.logout();
+      if (res && res.code === 1 && res.data) {
+        this.tableData = res.data;
       } else {
-        this.depart = [];
-        this.item = [];
+        this.tableData = [];
       }
       this.loading = false;
     },
-    async statusConfirm(id, status) {
-      await this.$confirm(`确定要改为${status === "1" ? "禁用" : "启用"}?`, {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning",
-      })
-        .then(async () => {
-          this.loading = true;
-          const model = {
-            id: id,
-            status: status === "1" ? "0" : "1",
-          };
-          const res = await asyncRequest.status(model);
-          if (res && res.code === 0) {
-            this.loading = false;
-            this.$notify.success({
-              title: "状态修改成功!",
-              message: "",
-            });
-            await this.searchList();
-          } else if (res && res.code >= 100 && res.code <= 104) {
-            await this.logout();
-          } else {
-            this.$message.warning(res.message);
-          }
-        })
-        .catch(() => {
-          console.log("取消");
-        });
-    },
   },
 };
 </script>
-   <style lang="scss" scoped>
-.organize {
-  .no-data {
-    padding: 25px 0;
-    text-align: center;
-    color: #909399;
-    margin: 30px 10px 0 10px;
-    border-radius: 8px;
-    border: 1px solid #dfe6ec;
-    // border-right: 1px solid #dfe6ec;
-    // border-bottom: 1px solid #dfe6ec;
-  }
+  <style lang="scss" scoped>
+.business {
   .my-breadcrumb {
     .my-breadcrumb-item {
       float: left;
       span {
-        height: 21px;
-        line-height: 21px;
+        height: 32px;
+        line-height: 32px;
       }
       .label {
         padding: 0 5px 0 0;
@@ -483,10 +464,20 @@ export default {
           color: #787878;
         }
       }
-      &.chover {
+      &:hover {
+        cursor: pointer;
+      }
+      &:last-child {
+        cursor: default;
+      }
+      &:only-child {
         cursor: pointer;
       }
+      // &.chover {
+      //   cursor: pointer;
+      // }
     }
   }
 }
 </style>
+   

+ 0 - 0
src/views/serviceParam/organize/企业组织架构 → src/views/serviceParam/organize/企业客户组织架构


+ 1 - 3
src/views/serviceParam/prepaidProportional/index.vue

@@ -2,7 +2,6 @@
   <div class="unit pagePadding">
     <ex-table
       v-loading="loading"
-      v-if="powers.some((i) => i == '001')"
       :table="table"
       :data="tableData"
       :columns="columns"
@@ -101,7 +100,7 @@
               :span="3"
               class="fr"
               style="width: 66px; padding: 0 0 0 10px"
-              v-if="powers.some((i) => i == '003')"
+              v-if="powers.some((i) => i == '002')"
             >
               <el-button
                 :size="searchSize"
@@ -192,7 +191,6 @@
         </el-tooltip>
       </template>
     </ex-table>
-    <no-auth v-else></no-auth>
     <!-- 弹窗 新增/修改 -->
     <add-edit
       :id="modelId"

+ 17 - 31
src/views/serviceParam/sort/addEdit.vue

@@ -24,6 +24,10 @@
             label-width="95px"
             class="demo-ruleForm"
           >
+            <el-form-item label="上级分类">
+              <el-input disabled :value="pid_name ? pid_name : '暂无上级分类'" />
+            </el-form-item>
+
             <el-form-item label="分类名称" prop="cat_name">
               <el-input
                 v-model="ruleForm.cat_name"
@@ -131,7 +135,7 @@ export default {
         await this.initData();
       }
 
-      await this.getAllSpecs();
+      // await this.getAllSpecs();
 
       this.loading = false;
     },
@@ -167,33 +171,16 @@ export default {
       }
     },
     async initData() {
-      const res = await asyncRequest.detail({ id: this.sitem.id });
-      if (res && res.code === 0 && res.data) {
-        const { pid, id, cat_name, cat_desc, spec, fund_code } = res.data;
-        let specs_id = [];
-        if (spec && spec.length > 0) {
-          spec.forEach((e) => {
-            specs_id.push(e.id);
-          });
-        }
-        console.log(pid);
-        console.log(pid ?? "0");
-        this.ruleForm = {
-          pid: (pid ?? "0") || "0",
-          id: id || "",
-          cat_name: cat_name || "",
-          specs_id: specs_id || [],
-          fund_code: fund_code || "",
-          cat_desc: cat_desc || "",
-        };
-        console.log(this.ruleForm);
-        this.$refs.ruleForm.resetFields();
-        this.$refs.ruleForm.clearValidate();
-      } else if (res && res.code >= 100 && res.code <= 104) {
-        await this.logout();
-      } else {
-        this.$message.warning(res.message);
-      }
+      const {
+        pid,
+        id,
+        cat_name
+      } = this.sitem
+      this.ruleForm = {
+        pid: (pid ?? "0") || "0",
+        id: id || "",
+        cat_name: cat_name || "",
+      };
     },
     async submitForm() {
       await this.$refs.ruleForm.validate(async (valid) => {
@@ -209,17 +196,16 @@ export default {
               res = await asyncRequest.update(model);
             }
             this.loading = false;
-            if (res && res.code === 0) {
+            if (res && res.code === 1) {
               const title = this.id === "add" ? "添加成功!" : "修改成功!";
               this.$notify.success({
                 title,
                 message: "",
               });
+
               this.showModelThis = false;
               // 刷新
               this.$emit("refresh");
-            } else if (res && res.code >= 100 && res.code <= 104) {
-              await this.logout();
             } else {
               this.$message.warning(res.message);
             }

+ 14 - 35
src/views/serviceParam/sort/index.vue

@@ -2,7 +2,6 @@
   <div class="sort pagePadding">
     <ex-table
       v-loading="loading"
-      v-if="powers.some((i) => i == '001')"
       :table="table"
       :data="tableData"
       :columns="columns"
@@ -102,7 +101,7 @@
               :span="3"
               class="fr"
               style="width: 66px; padding: 0 0 0 10px"
-              v-if="powers.some((i) => i == '003')"
+              v-if="powers.some((i) => i == '002')"
             >
               <el-button
                 :size="searchSize"
@@ -129,12 +128,11 @@
 
       <template #operation="{ scope }">
         <el-tooltip
-          v-if="powers.some((i) => i == '007')"
           effect="dark"
           content="详情"
           placement="top"
         >
-          <i class="el-icon-view tb-icon" @click="openModal(scope.row, '007')"></i>
+          <i class="el-icon-view tb-icon" @click="openModal(scope.row, '007')" />
         </el-tooltip>
         <el-tooltip
           v-if="powers.some((i) => i == '005')"
@@ -142,7 +140,7 @@
           content="修改"
           placement="top"
         >
-          <i class="el-icon-edit tb-icon" @click="openModal(scope.row, '005')"></i>
+          <i class="el-icon-edit tb-icon" @click="openModal(scope.row, '005')" />
         </el-tooltip>
         <el-tooltip
           v-if="powers.some((i) => i == '004') && scope.row.status + '' === '1'"
@@ -156,7 +154,7 @@
           ></i>
         </el-tooltip>
         <el-tooltip
-          v-if="powers.some((i) => i == '004') && scope.row.status + '' === '0'"
+          v-if="powers.some((i) => i == '003') && scope.row.status + '' === '0'"
           effect="dark"
           content="启用"
           placement="top"
@@ -192,7 +190,7 @@
         </el-tooltip>
       </template>
     </ex-table>
-    <no-auth v-else></no-auth>
+
     <!-- 弹窗 新增/修改 -->
     <add-edit
       :id="modelId"
@@ -288,7 +286,7 @@ export default {
         {
           prop: "cat_name",
           label: "分类名称",
-          width: "130px",
+          minWidth: "130px",
         },
         {
           prop: "status",
@@ -301,31 +299,16 @@ export default {
           label: "分类等级",
           width: "70px",
         },
-        {
-          prop: "fund_code",
-          label: "财务核算码",
-          width: "130px",
-        },
-
-        {
-          prop: "specs",
-          label: "关联规格",
-          width: "130px",
-        },
-        {
-          prop: "cat_desc",
-          label: "售后说明",
-        },
         // {
         //   prop: "company_name",
         //   label: "创建人部门",
         //   minWidth: "150px",
         // },
-        // {
-        //   prop: "creater",
-        //   label: "创建人",
-        //   width: "70px",
-        // },
+        {
+          prop: "creater",
+          label: "创建人",
+          minWidth: "70px",
+        },
         {
           prop: "addtime",
           label: "创建时间",
@@ -434,15 +417,13 @@ export default {
             status: status + "" === "1" ? "0" : "1",
           };
           const res = await asyncRequest.status(model);
-          if (res && res.code === 0) {
+          if (res && res.code === 1) {
             this.loading = false;
             this.$notify.success({
               title: "状态修改成功!",
               message: "",
             });
             await this.searchList();
-          } else if (res && res.code >= 100 && res.code <= 104) {
-            await this.logout();
           } else {
             this.loading = false;
             this.$message.warning(res.message);
@@ -463,14 +444,12 @@ export default {
             id: id,
           };
           const res = await asyncRequest.delete(model);
-          if (res && res.code === 0) {
+          if (res && res.code === 1) {
             this.$notify.success({
               title: "删除成功",
               message: "",
             });
             this.searchList();
-          } else if (res && res.code >= 100 && res.code <= 104) {
-            await this.logout();
           } else {
             this.$message.warning(res.message);
           }
@@ -483,7 +462,7 @@ export default {
     async searchList() {
       this.loading = true;
       const res = await asyncRequest.list(this.parmValue);
-      if (res && res.code === 0 && res.data) {
+      if (res && res.code === 1 && res.data) {
         this.tableData = res.data.list;
         this.tableData.forEach((e) => {
           if (e.im && e.im.length > 0) {

+ 1 - 8
src/views/serviceParam/storeType/index.vue

@@ -2,7 +2,6 @@
   <div class="unit pagePadding">
     <ex-table
       v-loading="loading"
-      v-if="powers.some((i) => i == '001')"
       :table="table"
       :data="tableData"
       :columns="columns"
@@ -157,7 +156,6 @@
         </el-tooltip>
       </template>
     </ex-table>
-    <no-auth v-else></no-auth>
     <!-- 弹窗 新增/修改 -->
     <add-edit
       :id="modelId"
@@ -369,14 +367,9 @@ export default {
     async searchList() {
       this.loading = true;
       const res = await asyncRequest.list(this.parmValue);
-      if (res && res.code === 0 && res.data) {
+      if (res && res.code === 1 && res.data) {
         this.tableData = res.data.list;
         this.pageInfo.total = Number(res.data.count);
-      } else if (res && res.code >= 100 && res.code <= 104) {
-        await this.logout();
-      } else {
-        this.tableData = [];
-        this.pageInfo.total = 0;
       }
       this.loading = false;
     },

+ 141 - 78
src/views/serviceParam/supplier/components/baseForm.vue

@@ -12,9 +12,9 @@
     <el-row>
       <el-col :span="24" style="margin-bottom:10px"><div class="supplierAdd-title" style="margin: 6px 0 0 10px">基础信息</div></el-col>
       <el-col :span="8">
-        <el-form-item label="供应商性质" prop="supplierNature">
+        <el-form-item label="供应商性质" prop="supplier_type">
           <el-select
-            v-model="ruleForm['supplierNature']"
+            v-model="ruleForm['supplier_type']"
             style="width: 100%"
             :disabled="type !== 'add' && type !== 'edit'"
             placeholder="供应商性质"
@@ -30,9 +30,9 @@
       </el-col>
 
       <el-col :span="8">
-        <el-form-item label="供应商来源" prop="supplierSource">
+        <el-form-item label="供应商来源" prop="source">
           <el-select
-            v-model="ruleForm.supplierSource"
+            v-model="ruleForm.source"
             style="width: 100%"
             :disabled="type !== 'add' && type !== 'edit'"
             placeholder="供应商来源"
@@ -49,7 +49,12 @@
       
       <el-col :span="8">
         <el-form-item label="有效期至" prop="validityPeriod">
-          <el-date-picker style="width:100%" v-model="ruleForm['validityPeriod']" placeholder="有效期" />
+          <el-date-picker 
+            style="width:100%" 
+            :disabled="type !== 'add' && type !== 'edit'" 
+            v-model="ruleForm['validityPeriod']" 
+            placeholder="有效期" 
+          />
         </el-form-item>
       </el-col>
 
@@ -73,14 +78,14 @@
       <el-col :span="8">
         <el-form-item
           label="营业执照"
-          prop="supplier_img"
+          prop="license_img"
           :disabled="id == 'view'"
           class="activity-upload"
         >
-          <div v-if="ruleForm.supplier_img" class="img-find">
+          <div v-if="ruleForm.license_img" class="img-find">
             <img
               v-viewer
-              :src="ruleForm.supplier_img"
+              :src="ruleForm.license_img"
               class="avatar hover fl"
               style="width: 50px; height: 50px"
             >
@@ -98,7 +103,7 @@
             <file-upload
               v-if="type !== 'view'"
               class="Upload"
-              :disabled="id == 'view'"
+              :disabled="type !== 'add' && type !== 'edit'"
               :accept="'.jpg,.png,.jpeg'"
               :multiple="true"
               :uploadcondition="beforeAvatarUpload"
@@ -109,12 +114,17 @@
         </el-form-item>
       </el-col>
 
-       <el-col :span="24"><div class="supplierAdd-title">行业信息</div></el-col>
-       <el-table border size="mini" style="margin-bottom:10px">
-          <el-table-column label="行业" prop="行业属性" />
-          <el-table-column label="行业资质" prop="行业资质属性" />
-          <el-table-column label="行业资质图片" prop="行业资质图片属性" />
-       </el-table>
+      <el-col :span="24"><div class="supplierAdd-title">行业信息</div></el-col>
+      <table-editor 
+        mode="modal"
+        :readonly="type !== 'add' && type !== 'edit'"
+        title="行业" 
+        :columns="columns" 
+        :rules="rules" 
+        ref="editor" 
+        :data.sync="ruleForm.industry" 
+        @rowUpdate="handleRowUpdate" 
+      />
 
       <el-col :span="24"><div class="supplierAdd-title">联系人信息</div></el-col>
       <el-col :span="8">
@@ -183,25 +193,20 @@
       </el-col>
       <el-col
         v-if="
-          (ruleForm.supplier_img === '' && (type === 'add' || type == 'edit')) ||
+          (ruleForm.license_img === '' && (type === 'add' || type == 'edit')) ||
             type == 'view'
         "
         :span="8"
       >
         <el-form-item label="公司类型" prop="nature">
-          <search-company-type
-            :value="ruleForm.nature"
-            :disabled="type == 'view'"
-            :size="'small'"
-            :is-detail="false"
-            :placeholder="'公司类型'"
-            @searchChange="type_search_change"
-          />
+          <el-select v-model="ruleForm.nature" style="width:100%" placeholder="公司类型">
+            <el-option v-for="option in supplier_typeoptions" :key="option.value" :value="option.value" :label="option.label" />
+          </el-select>
         </el-form-item>
       </el-col>
       <el-col
         v-if="
-          (ruleForm.supplier_img === '' && (type === 'add' || type == 'edit')) ||
+          (ruleForm.license_img === '' && (type === 'add' || type == 'edit')) ||
             type == 'view'
         "
         :span="8"
@@ -217,30 +222,25 @@
       </el-col>
       <el-col
         v-if="
-          (ruleForm.supplier_img === '' && (type === 'add' || type == 'edit')) ||
+          (ruleForm.license_img === '' && (type === 'add' || type == 'edit')) ||
             type == 'view'
         "
         :span="8"
       >
         <el-form-item label="成立日期" prop="registertime">
-          <el-input
-            v-model="ruleForm.registertime"
-            :disabled="type == 'view'"
-            placeholder="成立日期"
-            maxlength="50"
-          />
+          <el-date-picker style="width:100%" v-model="ruleForm['registertime']" placeholder="有效期" />
         </el-form-item>
       </el-col>
       <el-col
         v-if="
-          (ruleForm.supplier_img === '' && (type === 'add' || type == 'edit')) ||
+          (ruleForm.license_img === '' && (type === 'add' || type == 'edit')) ||
             type == 'view'
         "
         :span="24"
       >
-        <el-form-item label="详细地址" prop="addr">
+        <el-form-item label="详细地址" prop="register_addr">
           <el-input
-            v-model="ruleForm.addr"
+            v-model="ruleForm.register_addr"
             :disabled="type == 'view'"
             placeholder="详细地址"
             maxlength="200"
@@ -250,7 +250,7 @@
 
       <el-col
         v-if="
-          (ruleForm.supplier_img === '' && (type === 'add' || type == 'edit')) ||
+          (ruleForm.license_img === '' && (type === 'add' || type == 'edit')) ||
             type == 'view'
         "
         :span="24"
@@ -294,23 +294,23 @@ import {
 
 /**
  * @props
- * 供应商性质 supplierNature
- * 供应商来源 supplierSource
- * 有效期 validityPeriod
+ * 供应商性质 supplier_type
+ * 供应商来源 source
+ * 有效期 validityPeriodßß
  * 付款方式 pay_type
- * 营业执照 supplier_img
+ * 营业执照 license_img
  
  * 姓名 contactor
  * 手机号 mobile
  * 电子邮箱 email
  * 职位 position
  * 
- * 注册号 registerCode
+ * 注册号 registercode
  * 供应商名称 name
  * 公司类型 nature
  * 法人代表 legaler
  * 成立日期 registertime
- * 详细地址 addr
+ * 详细地址 register_addr
  * 运营范围 scope
  * 
 */
@@ -386,9 +386,9 @@ export default {
         { value: '1', label: '黑名单' }
       ],
       sourceoptions: [
-        { value: '0', label: '客户提供' },
-        { value: '1', label: '供应商' },
-        { value: '2', label: '公司开发' }
+        { value: '1', label: '客户提供' },
+        { value: '2', label: '供应商' },
+        { value: '3', label: '公司开发' }
       ],
       typeoptions: [
         { value: '0', label: '正式供应商' },
@@ -403,11 +403,10 @@ export default {
         { value: '1', label: '公司自提' }
       ],
       supplier_typeoptions: [
-        { value: '0', label: '生产厂家' },
-        { value: '1', label: '代理商' },
-        { value: '2', label: '经销商' },
-        { value: '3', label: '分销商' },
-        { value: '4', label: '电商平台' }
+        { value: '1', label: '股份' },
+        { value: '2', label: '有限' },
+        { value: '3', label: '独资' },
+        { value: '4', label: '合伙' }
       ],
       leveloptions: [
         { value: '2', label: '生产厂家' },
@@ -415,15 +414,60 @@ export default {
         { value: '1', label: '二级代理商' }
       ],
       pay_typeoptions: [
-        { value: '0', label: '现结' },
-        { value: '1', label: '月清' },
-        { value: '2', label: '双月清' }
+        { value: '1', label: '现结' },
+        { value: '2', label: '月清' },
+        { value: '3', label: '双月清' }
       ],
       ocr_status: [
         { id: '0', label: '未上传' },
         { id: '1', label: '识别成功' },
         { id: '2', label: '识别失败' }
       ],
+      columns:[
+        {
+          prop:'industry_id',
+          label:'请选择行业',
+          type:'select',
+          options:[]
+        },
+        {
+          prop: 'industry_img',
+          label:'行业资质',
+          type:'select',
+          options:[
+            {label:'需要',value:'1'},
+            {label:'不需要',value:'0'},
+          ]
+        },
+        {
+          prop:'image',
+          label:"行业资质图片",
+          type:'image'
+        }
+      ],
+      rules:{
+        industry_id:[
+          {
+            required:true,
+            trigger:'change',
+            message:'请选择行业'
+          },
+        ],
+        industry_img:[
+          {
+            required:true,
+            trigger:'change',
+            message:'请选择行业资质'
+          }
+        ],
+        image:[
+          {
+            required:true,
+            trigger:'blur',
+            message:'请上传行业资质图片'
+          }
+        ]
+      },
       title: '添加供应商',
       showModelThis: this.showModel,
       pickerOptions: {
@@ -431,17 +475,19 @@ export default {
           return time.getTime() > Date.now()
         }
       },
-      ruleForm: {},
+      ruleForm: {
+        industry:[]
+      },
       rulesThis: this.rules,
       natureOfSupplierList:[
-        {value:'0',label:'公务公司'},
-        {value:'1',label:'服务商'},
+        {value:'1',label:'公务公司'},
+        {value:'2',label:'服务商'},
       ],
       rules: {
-        supplierNature: [{ required: true, message: '请选择供应商性质', trigger: 'change' }],
-        supplierSource: [{ required: true, message: '请选择供应商来源', trigger: 'change' }],
+        supplier_type: [{ required: true, message: '请选择供应商性质', trigger: 'change' }],
+        source: [{ required: true, message: '请选择供应商来源', trigger: 'change' }],
         validityPeriod:[{ required: true, message: '请选择有效期', trigger: 'change' }],
-        supplier_img: [{ required: true, message: '请上传营业执照', trigger: 'blur' }],
+        license_img: [{ required: true, message: '请上传营业执照', trigger: 'blur' }],
 
         coop_state: [{ required: true, message: '请选择合作状态', trigger: 'change' }],
         type: [{ required: true, message: '请选择申请类型', trigger: 'change' }],
@@ -476,7 +522,7 @@ export default {
         registercode: [{ required: true, validator: validateLicense, trigger: 'blur' }],
         name: [{ required: true, message: '供应商名称不能为空', trigger: 'blur' }],
         nature: [{ required: true, message: '公司类型不能为空', trigger: 'change' }],
-        addr: [{ required: true, validator: validateAddr, trigger: 'blur' }],
+        register_addr: [{ required: true, validator: validateAddr, trigger: 'blur' }],
         legaler: [{ required: true, message: '法人代表不能为空', trigger: 'blur' }],
         registertime: [
           { required: true, message: '成立时间不能为空', trigger: 'change' }
@@ -518,28 +564,35 @@ export default {
         supplier_type,
         level,
         pay_type,
-        supplier_img,
+        license_img,
         prove_img,
-        contactor,
-        mobile,
-        position,
         registercode,
         name,
         nature,
-        addr,
+        register_addr,
         legaler,
         registertime,
         scope,
         personid,
         person,
         telephone,
-        email
+        contactor_info = [],
+        industry_info = []
       } = this.sitem
 
+      const [ citem = {} ] = contactor_info
+      const {
+        email,
+        mobile,
+        contactor,
+        position,
+      } = citem
+
       this.hand_name = person || ''
       this.ruleForm = {
         id: id || '',
         code: code || '',
+        industry:industry_info,
         coop_state: coop_state || '',
         source: source || '',
         type: type || '',
@@ -548,7 +601,7 @@ export default {
         supplier_type: supplier_type || '',
         level: level || '',
         pay_type: pay_type || '',
-        supplier_img: supplier_img || '',
+        license_img: license_img || '',
         prove_img: prove_img ? (prove_img || '').split(',') : [],
         contactor: contactor || '',
         mobile: mobile || '',
@@ -558,7 +611,7 @@ export default {
         name: name || '',
         email: email || '',
         nature: nature || '',
-        addr: addr || '',
+        register_addr: register_addr || '',
         legaler: legaler || '',
         registertime: registertime || '',
         scope: scope || '',
@@ -570,6 +623,7 @@ export default {
       this.$refs.ruleForm.validateField('prove_img')
     },
     async submitForm() {
+      this.ruleForm.license_img = "http://stocknew.test241.wanyuhengtong.com/storage/topic/20230518/logo_20230518161652.png"
       await this.$refs.ruleForm.validate(async(valid) => {
         if (valid) {
           if (this.loading) {
@@ -579,6 +633,19 @@ export default {
           const model = JSON.parse(JSON.stringify(this.ruleForm))
           model.prove_img = model.prove_img.toString()
           model.personid = model.personid.toString()
+
+          const mapProps = {
+            contact:["contactor","mobile","email","position"]
+          }
+
+          Object.keys(mapProps).forEach(key => {
+            model[key] = [{}]
+            mapProps[key].forEach(property => {
+              model[key][0][property] = model[property]
+              delete model[property]
+            })
+          })
+
           let res = {}
           if (this.id === 'add') {
             delete model['id']
@@ -587,7 +654,7 @@ export default {
             res = await asyncRequest.update(model)
           }
           this.loading = false
-          if (res && res.code === 0) {
+          if (res && res.code === 1) {
             const title = this.id === 'add' ? '添加成功!' : '修改成功!'
             this.$notify.success({
               title,
@@ -596,10 +663,6 @@ export default {
             this.showModelThis = false
             // 刷新
             this.$emit('refresh', res.data)
-          } else if (res && res.code >= 100 && res.code <= 104) {
-            await this.logout()
-          } else {
-            this.$message.warning(res.message)
           }
         } else {
           console.log('error submit!!')
@@ -608,8 +671,8 @@ export default {
       })
     },
     deleteimg() {
-      this.ruleForm.supplier_img = ''
-      this.$refs.ruleForm.validateField('supplier_img')
+      this.ruleForm.license_img = ''
+      this.$refs.ruleForm.validateField('license_img')
     },
     handleHandoverName(e) {
       if (e && e.id) {
@@ -644,8 +707,8 @@ export default {
         await this.logout()
       } else {
         if (type === 1) {
-          this.ruleForm.supplier_img = url
-          this.$refs.ruleForm.validateField('supplier_img')
+          this.ruleForm.license_img = url
+          this.$refs.ruleForm.validateField('license_img')
         } else if (type === 2) {
           this.ruleForm.good_img = url
           this.$refs.ruleForm.validateField('good_img')
@@ -672,7 +735,7 @@ export default {
       if (res !== 'break') {
         this.$message.error('图片上传失败!')
         this.$refs.ruleForm.validateField(
-          type === 1 ? 'supplier_img' : type === 2 ? 'good_img' : 'good_info_img'
+          type === 1 ? 'license_img' : type === 2 ? 'good_img' : 'good_info_img'
         )
       }
     },

+ 3 - 7
src/views/serviceParam/supplier/detail.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="supplierDetail">
-    <div class="supplierDetail-main" v-if="powers.some((i) => i == '007')">
+    <div class="supplierDetail-main" v-if="powers.some((i) => i == '001')">
       <el-tabs v-model="activeTabs">
         <el-tab-pane label="新建供应商" name="0" v-if="queryType === 'add'">
           <base-form
@@ -171,18 +171,14 @@ export default {
     async initData() {
       this.loading = true;
       const { code, message, data } = await asyncRequest.detail({
-        code: this.queryId,
+        id: this.queryId,
       });
       this.loading = false;
-      if (code === 0) {
+      if (code === 1) {
         this.sitem = JSON.parse(JSON.stringify(data));
         const { status } = this.sitem;
         this.status = status;
         this.getNewTime();
-      } else if (code >= 100 && code <= 104) {
-        await this.logout();
-      } else {
-        this.$message.warning(message);
       }
     },
     getNewTime() {

+ 32 - 55
src/views/serviceParam/supplier/index.vue

@@ -2,7 +2,6 @@
   <div class="supplier pagePadding">
     <ex-table
       v-loading="loading"
-      v-if="powers.some((i) => i == '001')"
       :table="table"
       :data="tableData"
       :columns="columns"
@@ -30,8 +29,8 @@
                 :type="1"
                 :width="'135px'"
                 :size="searchSize"
-                :start="parmValue.createStart"
-                :end="parmValue.createEnd"
+                :start="parmValue.start"
+                :end="parmValue.end"
                 @timeReturned="handleTime"
               />
             </el-col>
@@ -72,7 +71,7 @@
             <el-col :span="4" style="width: 333px;">
               <el-input
                 :size="searchSize"
-                v-model="parmValue.supplierName"
+                v-model="parmValue.name"
                 :maxlength="40"
                 @blur="
                   pageInfo.curr = 1;
@@ -82,7 +81,7 @@
                 placeholder="供应商名称"
               ></el-input>
             </el-col>
-            <el-col :span="4" style="margin-left:10px">
+            <!-- <el-col :span="4" style="margin-left:10px">
               <el-select placeholder="供应商等级" size="mini" v-model="parmValue.level" style="width:100%"   @change="
                   pageInfo.curr = 1;
                   parmValue.page = 1;
@@ -90,9 +89,9 @@
                 ">
                 <el-option v-for="level in supplierLevelList" :key="level.value" :value="level.value" :label="level.label" />
               </el-select>
-            </el-col>
+            </el-col> -->
             
-            <el-col :span="4" style="width: 120px; padding: 0 0 0 10px">
+            <!-- <el-col :span="4" style="width: 120px; padding: 0 0 0 10px">
               <el-input
                 :size="searchSize"
                 v-model="parmValue.creator"
@@ -104,12 +103,12 @@
                 "
                 placeholder="创建人"
               ></el-input>
-            </el-col>
+            </el-col> -->
             <el-col
               :span="6"
               class="fr"
               style="width: 306px; padding: 0 0 0 10px"
-              v-if="powers.some((i) => i == '003')"
+              v-if="powers.some((i) => i == '002')"
             >
               <el-button
                 :size="searchSize"
@@ -119,15 +118,6 @@
               >
                 添加
               </el-button>
-
-              <el-button
-                :size="searchSize"
-                type="success"
-                style="float: right;margin-right:10px"
-                @click="handleSetSupplierLevel"
-              >
-                批量设置供应商等级
-              </el-button>
             </el-col>
           </el-row>
         </div></template>
@@ -175,26 +165,17 @@
 
       <template #operation="{ scope }">
         <el-tooltip
-          v-if="powers.some((i) => i == '007')"
           effect="dark"
           content="详情"
           placement="top"
         >
           <i
             class="el-icon-view tb-icon"
-            @click="getRouter('supplierDetail', scope.row.code)"
+            @click="getRouter('supplierDetail', scope.row.id)"
           ></i>
         </el-tooltip>
-        <!-- <el-tooltip
-          v-if="powers.some((i) => i == '005')"
-          effect="dark"
-          content="修改"
-          placement="top"
-        >
-          <i class="el-icon-edit tb-icon" @click="gotoEdit(scope.row, '005')"></i>
-        </el-tooltip> -->
         <el-tooltip
-          v-if="powers.some((i) => i == '004') && scope.row.status + '' === '1'"
+          v-if="powers.some((i) => i == '001') && scope.row.status + '' === '1'"
           effect="dark"
           content="禁用"
           placement="top"
@@ -206,7 +187,7 @@
         </el-tooltip>
 
         <el-tooltip
-          v-if="powers.some((i) => i == '004') && scope.row.status + '' === '0'"
+          v-if="powers.some((i) => i == '001') && scope.row.status + '' === '0'"
           effect="dark"
           content="启用"
           placement="top"
@@ -259,7 +240,6 @@
         </el-tooltip> -->
       </template>
     </ex-table>
-    <no-auth v-else></no-auth>
 
     <industry-modal :visible.sync="modalVisible.industry" />
     <service-charge-modal :visible.sync="modalVisible.service" />
@@ -280,15 +260,14 @@ import ServiceChargeModal from "./components/serviceChargeModal.vue"
 import ToPublicModal from "./components/toPublicModal.vue"
 import SupplierLevelModal from "./components/supplierLevelModal.vue"
 
-import { createEmptyStringObject } from '@/utils/static';
 import { supplierLevelList } from "./columns"
 
 /**
  * @props
- * createStart // 创建开始时间
- * createEnd // 创建结束时间
+ * start // 创建开始时间
+ * end // 创建结束时间
  * status // 状态
- * supplierName // 供应商名称
+ * name // 供应商名称
  * creator // 创建人
  * level // 供应商等级
 */
@@ -332,10 +311,10 @@ export default {
       parmValue: {
         page: 1, // 页码
         size: 15, // 每页显示条数
-        createStart:"", // 创建开始时间
-        createEnd:"", // 创建结束时间
+        start:"", // 创建开始时间
+        end:"", // 创建结束时间
         status:"", // 状态
-        supplierName:"", // 供应商名称
+        name:"", // 供应商名称
         creator:"", // 创建人
         level: "" // 供应商等级
       },
@@ -394,11 +373,11 @@ export default {
           label: "联系人",
           minWidth: "80",
         },
-        {
-          prop: "creater",
-          label: "创建人",
-          minWidth: "80",
-        },
+        // {
+        //   prop: "creater",
+        //   label: "创建人",
+        //   minWidth: "80",
+        // },
         {
           prop: "addtime",
           label: "创建时间",
@@ -481,10 +460,10 @@ export default {
       this.parmValue = {
         page: 1, // 页码
         size: 15, // 每页显示条数
-        createStart:"", // 创建开始时间
-        createEnd:"", // 创建结束时间
+        start:"", // 创建开始时间
+        end:"", // 创建结束时间
         status:"", // 状态
-        supplierName:"", // 供应商名称
+        name:"", // 供应商名称
         creator:"", // 创建人
         level: "" // 供应商等级
       };
@@ -498,11 +477,11 @@ export default {
     },
     // 时间
     async handleTime(e) {
-      this.parmValue.createStart = e.startTime || "";
-      this.parmValue.createEnd = e.endTime || "";
+      this.parmValue.start = e.startTime || "";
+      this.parmValue.end = e.endTime || "";
       if (
-        (this.parmValue.createStart !== "" && this.parmValue.createEnd !== "") ||
-        (this.parmValue.createEnd === "" && this.parmValue.createEnd === "")
+        (this.parmValue.start !== "" && this.parmValue.end !== "") ||
+        (this.parmValue.end === "" && this.parmValue.end === "")
       ) {
         this.pageInfo.curr = 1;
         this.parmValue.page = 1;
@@ -597,8 +576,8 @@ export default {
     // 刷新表格
     async searchList() {
       if (
-        (this.parmValue.createStart !== "" && this.parmValue.createEnd === "") ||
-        (this.parmValue.createStart === "" && this.parmValue.createEnd !== "")
+        (this.parmValue.start !== "" && this.parmValue.end === "") ||
+        (this.parmValue.start === "" && this.parmValue.end !== "")
       ) {
         this.$message.warning("开始时间和结束时间不能为空");
         return;
@@ -607,12 +586,10 @@ export default {
       this.loading = true;
       const { code, data, message } = await asyncRequest.list(this.parmValue);
       let scode = parseInt(code + "");
-      if (scode === 0) {
+      if (scode === 1) {
         const { list, count } = data;
         this.tableData = list;
         this.pageInfo.total = Number(count + "");
-      } else if (scode >= 100 && scode <= 104) {
-        await this.logout();
       } else {
         this.tableData = [];
         this.pageInfo.total = 0;

+ 63 - 63
src/views/serviceParam/supplierStore/components/baseForm.vue

@@ -152,7 +152,6 @@
 </template>
 <script>
 import asyncRequest from '@/apis/service/serviceParam/supplierStore'
-import 'ol/ol.css';
 import Map from 'ol/Map'; //地图初始化
 import * as source from 'ol/source';
 import Feature from "ol/Feature"
@@ -161,6 +160,7 @@ import TileLayer from 'ol/layer/Tile';
 import * as olProj from "ol/proj"
 import * as style from "ol/style"
 import * as layer from "ol/layer"
+import 'ol/ol.css';
 import View from 'ol/View';
 import resToken from '@/mixins/resToken'
 import {
@@ -246,15 +246,31 @@ export default {
           return time.getTime() > Date.now()
         }
       },
-      ruleForm: {},
+      ruleForm: {
+      supplier:"",
+        storeName:"",
+        storeType:"",
+        storeImage:"",
+        storeAddr:[],
+        contactor:"",
+        mobile:"",
+        email:"",
+        position:"",
+      },
       rulesThis: this.rules,
       rules: {
         supplier: [{ required: true, message: '请选择供应商', trigger: 'change' }],
         storeName: [{ required: true, message: '请输入门店名称', trigger: 'change' }],
         storeType: [{ required: true, message: '请选择门店类型', trigger: 'change' }],
         storeImage: [{ required: true, message: '请上传门店主图', trigger: 'change' }],
-        storeAddr: [{ required: true, message: '请选择门店地址', trigger: 'change' }],
-
+        storeAddr: [{ required: true, message: '请选择门店地址', trigger: 'change',validator(rule,value,callback){
+          console.log(value)
+          if ((!Array.isArray(value) && !value) || (Array.isArray(value) && value.length === 0)) {
+            callback(new Error('门店地址不能为空!'))
+          } else {
+            callback()
+          }
+        }}],
         contactor: [{ required: true, message: '姓名不能为空', trigger: 'blur' }],
         mobile: [{ required: true, validator: validatemobile, trigger: 'blur' }],
         email: [{ required: true, validator: validEmail, trigger: 'blur' }],
@@ -268,44 +284,12 @@ export default {
     this.initForm()
   },
   methods: {
-    createLabelStyle() {
-        return new style.Style({
-            image: new style.Icon({
-                anchor: [40, 42],
-                scale: 0.2, // 图标缩小显示
-                anchorOrigin: 'bottom', // 标注样式的起点位置
-                anchorXUnits: 'pixels', // X方向单位:分数
-                anchorYUnits: 'pixels', // Y方向单位:像素
-                offsetOrigin: 'bottom', // 偏移起点位置的方向
-                opacity: 1, // 透明度
-                src: 'dian.png'  //图标的URL
-            }),
-            text: new style.Text({
-                textAlign: 'center',            //位置
-                textBaseline: 'middle',         //基准线
-                font: 'normal 14px 微软雅黑',    //文字样式
-                fill: new style.Fill({       //文本填充样式(即文字颜色)
-                    color: '#000'
-                }),
-                stroke: new style.Stroke({
-                    color: '#F00',
-                    width: 2
-                })
-            })
-        });
-    },
-    registerMapEvent(){
-      this.map.on('click',(evt) => {
-        const { coordinate } = evt
-        this.feature.set('geometry',new Point(coordinate))
-      })
-    },
     initMap(){
       this.map = new Map({
         layers:[
           new TileLayer({
             source: new source.XYZ({
-                url: 'http://t3.tianditu.com/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=' + key
+                url: 'http://t{0-7}.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=' + key
             })
           }),
           new TileLayer({
@@ -326,7 +310,7 @@ export default {
       const iconFeature = new Feature();
       const feature = new Feature({
         geometry: new Point([0, 0])
-      }) 
+      })
 
       feature.setStyle(this.createLabelStyle())
 
@@ -340,6 +324,39 @@ export default {
       this.feature = feature
       this.map.addLayer(vectorLayer)
     },
+    createLabelStyle() {
+      return new style.Style({
+        image: new style.Icon({
+          anchor: [95,45],
+          scale: 0.2, // 图标缩小显示
+          anchorOrigin: 'bottom-right', // 标注样式的起点位置
+          anchorXUnits: 'pixels', // X方向单位:分数
+          anchorYUnits: 'pixels', // Y方向单位:像素
+          offsetOrigin: 'bottom-left', // 偏移起点位置的方向
+          opacity: 1, // 透明度
+          src: 'dian.png'  //图标的URL
+        }),
+        text: new style.Text({
+          textAlign: 'center',            //位置
+          textBaseline: 'middle',         //基准线
+          font: 'normal 14px 微软雅黑',    //文字样式
+          fill: new style.Fill({       //文本填充样式(即文字颜色)
+            color: '#000'
+          }),
+          stroke: new style.Stroke({
+            color: '#F00',
+            width: 2
+          })
+        })
+      });
+    },
+    registerMapEvent(){
+      this.map.on('click',(evt) => {
+        const { coordinate } = evt
+        this.ruleForm.storeAddr = [...coordinate]
+        this.feature.set('geometry',new Point(coordinate))
+      })
+    },
     async initForm() {
       this.hand_name = ''
       this.loading = true
@@ -390,31 +407,14 @@ export default {
 
       this.hand_name = person || ''
       this.ruleForm = {
-        id: id || '',
-        code: code || '',
-        supplier: supplier || '',
-        storeName: storeName || '',
-        type: type || '',
-        category: category || '',
-        delivery_way: delivery_way || '',
-        supplier_type: supplier_type || '',
-        level: level || '',
-        pay_type: pay_type || '',
-        storeImage: storeImage || '',
-        prove_img: prove_img ? (prove_img || '').split(',') : [],
-        contactor: contactor || '',
-        mobile: mobile || '',
-        telephone: telephone || '',
-        position: position || '',
-        registercode: registercode || '',
-        name: name || '',
-        email: email || '',
-        nature: nature || '',
-        addr: addr || '',
-        legaler: legaler || '',
-        registertime: registertime || '',
-        scope: scope || '',
-        personid: personid ? [personid] : []
+        storeName:"",
+        storeType:"",
+        storeImage:"",
+        storeAddr:[],
+        contactor:"",
+        mobile:"",
+        email:"",
+        position:"",
       }
     },
     closeImg(index) {

+ 13 - 13
src/views/serviceParam/supplierStore/storeDecoration.vue

@@ -18,7 +18,7 @@
             </el-select>
         </el-form-item>
       </el-col>
-      
+
       <el-col :span="4">
         <el-form-item label="店铺风格" prop="店铺风格属性">
           <el-checkbox-group v-model="ruleForm['店铺风格属性']">
@@ -27,7 +27,7 @@
         </el-form-item>
       </el-col>
     </el-row>
-    
+
     <el-row>
         <el-col :span="24"><div class="supplierAdd-title" style="margin: 6px 0 0 10px">店铺简介</div></el-col>
            <div style="padding:35px">
@@ -51,34 +51,34 @@
       <el-col :span="24" style="padding:20px;padding-top:0px">
         <table-editor mode="table" :columns="activityColumns" :data="[]" :rules="activityRules" />
       </el-col>
-      
+
       <el-col :span="24"><div class="supplierAdd-title">酒店服务设施</div></el-col>
       <el-col :span="24">
         <div style="padding:35px;padding-top:0px;box-sizing:border-box">
             <dynamic-tags />
          </div>
       </el-col>
-      
+
       <el-col :span="24"><div class="supplierAdd-title">餐饮设施</div></el-col>
       <el-col :span="24">
         <div style="padding:35px;padding-top:0px;box-sizing:border-box">
             <dynamic-tags />
          </div>
       </el-col>
-      
+
       <el-col :span="24"><div class="supplierAdd-title">客房服务设施</div></el-col>
       <el-col :span="24">
          <div style="padding:35px;padding-top:0px;box-sizing:border-box">
             <dynamic-tags />
          </div>
       </el-col>
-      
+
 
       <el-col :span="24"><div class="supplierAdd-title">详情图片</div></el-col>
       <el-col :span="24" style="padding:20px;padding-top:0px">
         <table-editor mode="modal" :columns="pictureColumns" :data="[]" :rules="pictureRules" />
       </el-col>
-      
+
       <el-col :span="24"><div class="supplierAdd-title">会议室</div></el-col>
       <el-col :span="24" style="padding:20px;padding-top:0px">
         <table-editor mode="modal" :columns="conferenceColumns" :data="[]" :rules="conferenceRules" />
@@ -88,7 +88,7 @@
       <el-col :span="24" style="padding:20px;padding-top:0px">
         <table-editor mode="modal" :columns="guestColumns" :data="[]" :rules="guestRules" />
       </el-col>
-      
+
       <el-col :span="24"><div class="supplierAdd-title">会议服务设施</div></el-col>
       <el-col :span="24" style="padding:20px;padding-top:0px">
         <table-editor mode="table" :columns="serviceColumns" :data="[]" :rules="serviceRules" />
@@ -100,12 +100,12 @@
 import asyncRequest from '@/apis/service/serviceParam/supplierStore'
 import resToken from '@/mixins/resToken'
 import DynamicTags from "@/components/dynamic-tags"
-import { 
+import {
          pictureColumns,
-         pictureRules, 
-         conferenceColumns, 
-         conferenceRules, 
-         guestColumns, 
+         pictureRules,
+         conferenceColumns,
+         conferenceRules,
+         guestColumns,
          guestRules,
          serviceColumns,
          serviceRules,

+ 716 - 0
src/views/system/action/index.vue

@@ -0,0 +1,716 @@
+<template>
+  <div class="action" v-loading="loading">
+    <div
+      class="action_show_box"
+      v-if=" powers.some((i) => i == '001')"
+    >
+      <ul class="role-list fl">
+        <p class="role-list__title">角色列表</p>
+        <p
+          v-if="roleList.length == 0"
+          style="line-height: 60px; text-align: center; color: #909399"
+        >
+          暂无数据
+        </p>
+
+        <li
+          v-for="(item, index) in roleList"
+          :key="'role' + index"
+          class="role-list__item"
+          :class="{ active: item.id == roleActive.id }"
+          @click="!isBtnDisabled && switchRoleHandle(item)"
+        >
+          {{ item.role_name }}
+          <i v-if="isBtnDisabled && item.id == roleActive.id" class="el-icon-loading" />
+        </li>
+      </ul>
+
+
+      <div class="rule-view fr">
+        <div class="rule-list" v-if="roleList.length > 0">
+          <el-row v-for="(item, index) in actionList" :key="'menu' + item.id + index">
+            <el-col v-if="item.children && item.children.length > 0" class="ffff" :span="24">
+              <div class="ftitle">
+                <span>{{ item.menu_name }}</span>
+              </div>
+              <div class="fbody">
+                <div
+                  class="fbody-item"
+                  v-for="(subItem, subIndex) in item.children"
+                  :key="'yemian' + subItem.id + subIndex"
+                >
+                  <template
+                    v-if="
+                      !(
+                        subItem.action &&
+                        subItem.action.length === 0 &&
+                        subItem.action_data &&
+                        subItem.action_data.length === 0
+                      )
+                    "
+                  >
+                    <div class="stitle">
+                      <span class="_h2">{{ subItem.menu_name }}</span>
+                      <el-radio-group
+                        style="margin: 0 0 0 20px"
+                        size="mini"
+                        v-if="subItem && subItem.private && subItem.private.length === 2"
+                        v-model="subItem.is_private_change"
+                      >
+                        <el-radio-button
+                          v-for="(radioN, ri) in subItem.private"
+                          :key="radioN.label + ri"
+                          :label="String(radioN.id)"
+                          >{{ radioN.label }}</el-radio-button
+                        >
+                      </el-radio-group>
+                    </div>
+                    <div
+                      class="scheck"
+                      v-if="subItem.action && subItem.action.length > 0"
+                    >
+                      <div class="checkAll">
+                        <el-checkbox
+                          v-model="subItem.checkAll"
+                          :disabled="!powers.some((i) => i == '001')"
+                          :indeterminate="indeterminateCheck(subItem)"
+                          @change="handleCheckAllChange($event, index, item, subIndex)"
+                          >功能全选</el-checkbox
+                        >
+                      </div>
+                      <div class="checkItem">
+                        <el-checkbox-group
+                          v-model="subItem.checkList"
+                          :disabled="!powers.some((i) => i == '001')"
+                          @change="
+                            handleCheckedGroupChange($event, index, item, subIndex)
+                          "
+                        >
+                          <template v-for="children in subItem.action">
+                            <el-checkbox
+                              :disabled="!powers.some((i) => i == '001')"
+                              :label="String(children.id)"
+                              :key="'checkItem' + children.id"
+                              @change="
+                                handleCheckedChange(
+                                  $event,
+                                  String(children.id),
+                                  index,
+                                  subIndex,
+                                  item
+                                )
+                              "
+                              >{{ children.action_name }}</el-checkbox
+                            >
+                          </template>
+                        </el-checkbox-group>
+                      </div>
+                    </div>
+                    <div
+                      class="sfield"
+                      v-if="subItem.action_data && subItem.action_data.length > 0"
+                    >
+                      <div class="checkAll">
+                        <el-checkbox
+                          v-model="subItem.fieldAll"
+                          :disabled="!powers.some((i) => i == '001')"
+                          :indeterminate="indeterminateField(subItem)"
+                          @change="handleFieldAllChange($event, index, item, subIndex)"
+                          >字段全选</el-checkbox
+                        >
+                      </div>
+                      <div class="checkItem">
+                        <el-checkbox-group
+                          v-model="subItem.fieldList"
+                          :disabled="!powers.some((i) => i == '001')"
+                          @change="handleFieldGroupChange($event, index, item, subIndex)"
+                        >
+                          <template v-for="children in subItem.action_data">
+                            <el-checkbox
+                              :label="String(children.id)"
+                              :disabled="!powers.some((i) => i == '001')"
+                              :key="'FieldItem' + children.id"
+                              @change="
+                                handleFieldChange(
+                                  $event,
+                                  String(children.id),
+                                  index,
+                                  subIndex,
+                                  item
+                                )
+                              "
+                              >{{ children.field_name }}</el-checkbox
+                            >
+                          </template>
+                        </el-checkbox-group>
+                      </div>
+                    </div>
+                  </template>
+                </div>
+              </div>
+            </el-col>
+          </el-row>
+        </div>
+
+        <p
+          v-else
+          style="line-height: 60px;margin-top: 50px ;text-align: center; color: #909399"
+        >
+          暂无数据
+        </p>
+      </div>
+
+      <div class="rule-bottom fr" v-if="roleList.length > 0">
+        <el-button
+          size="small"
+          type="primary"
+          v-if="powers.some((i) => i == '001')"
+          :disabled="isBtnDisabled"
+          @click="save()"
+          >提 交</el-button
+        >
+      </div>
+    </div>
+
+    <div v-else>
+      <no-auth></no-auth>
+    </div>
+  </div>
+</template>
+<script>
+import asyncRequest from "@/apis/service/system/action";
+import resToken from "@/mixins/resToken";
+
+export default {
+  name: "Action",
+  mixins: [resToken],
+  data() {
+    return {
+      ruleForm: {},
+      // 按钮是否可点击
+      isBtnDisabled: true,
+      // 当前角色
+      roleActive: {},
+      actionChange: [],
+      // 角色列表
+      roleList: [],
+      rules: [],
+      // 功能权限列表
+      actionList: [],
+      action_data: [], // 字段数据
+      action: [], // 功能数据
+      private_data: [], //私有数据菜单ID
+      private_field: [],
+      loading:false
+    };
+  },
+  computed: {
+    powers() {
+      const tran =
+        this.$store.getters.btnList.find((i) => i.menu_route == "action") || {};
+      const { action } = tran ?? {};
+      return action ?? [];
+    },
+    indeterminateCheck() {
+      return (item) => {
+        // 选中子节点的数量
+        const selectItemLength = item.action.filter(
+          (filitem) =>
+            item.checkList.findIndex((finditem) => finditem === String(filitem.id)) > -1
+        ).length;
+        // 未选中子节点的数量
+        const noSlectItemLength = item.action.filter(
+          (filitem) =>
+            item.checkList.findIndex((finditem) => finditem === String(filitem.id)) == -1
+        ).length;
+        // // 当前节点的index
+        // 存在选中子节点且存在未选中子节点为中间态
+        return selectItemLength > 0 && noSlectItemLength > 0;
+      };
+    },
+    indeterminateField() {
+      return (item) => {
+        // 选中子节点的数量
+        const selectItemLength = item.action_data.filter(
+          (filitem) =>
+            item.fieldList.findIndex((finditem) => finditem === filitem.id) > -1
+        ).length;
+        // 未选中子节点的数量
+        const noSlectItemLength = item.action_data.filter(
+          (filitem) =>
+            item.fieldList.findIndex((finditem) => finditem === filitem.id) == -1
+        ).length;
+        // // 当前节点的index
+        // 存在选中子节点且存在未选中子节点为中间态
+        return selectItemLength > 0 && noSlectItemLength > 0;
+      };
+    },
+  },
+  mounted() {
+    this.initactionList();
+  },
+
+  methods: {
+    recursionFilterActionList(list) {
+      const _list = []
+      for (let i = 0; i < list.length; i++) {
+        const item = list[i]
+
+        if (item.level !== 1) _list.push(item)
+        if (item.children && item.children.length > 0) item.children = this.recursionFilterActionList(item.children)
+      }
+      return _list
+    },
+    // 全选/全不选
+    handleCheckAllChange(checkAll, index, item, subIndex) {
+      this.actionList[index].children[subIndex].checkAll = checkAll;
+      this.$set(this.actionList, index, item);
+      this.actionList[index].children[subIndex].action.forEach((element) => {
+        const findindex = this.actionList[index].children[subIndex].checkList.findIndex(
+          (findItem) => findItem === String(element.id)
+        );
+        if (checkAll && findindex == -1) {
+          this.actionList[index].children[subIndex].checkList.push(String(element.id));
+        } else if (!checkAll && findindex > -1) {
+          this.actionList[index].children[subIndex].checkList.splice(findindex, 1);
+        }
+      });
+    },
+    // 全选/全不选
+    handleFieldAllChange(fieldAll, index, item, subIndex) {
+      this.actionList[index].children[subIndex].fieldAll = fieldAll;
+      this.$set(this.actionList, index, item);
+      this.actionList[index].children[subIndex].action_data.forEach((element) => {
+        const findindex = this.actionList[index].children[subIndex].fieldList.findIndex(
+          (findItem) => findItem === String(element.id)
+        );
+        if (fieldAll && findindex == -1) {
+          this.actionList[index].children[subIndex].fieldList.push(String(element.id));
+        } else if (!fieldAll && findindex > -1) {
+          this.actionList[index].children[subIndex].fieldList.splice(findindex, 1);
+        }
+      });
+    },
+    // 复选框组内的选中/不选中
+    handleCheckedGroupChange(event, index, item, subIndex) {
+      // console.log(event, index, subIndex);
+      this.actionList[index].children[subIndex].checkAll = this.actionList[index].children[
+        subIndex
+      ].action.every(
+        (evitem) =>
+          this.actionList[index].children[subIndex].checkList.findIndex(
+            (finditem) => finditem === String(evitem.id)
+          ) > -1
+      );
+      this.$set(this.actionList, index, item);
+    },
+    // 复选框组内的选中/不选中
+    handleFieldGroupChange(event, index, item, subIndex) {
+      this.actionList[index].children[subIndex].fieldAll = this.actionList[index].children[
+        subIndex
+      ].action_data.every(
+        (evitem) =>
+          this.actionList[index].children[subIndex].fieldList.findIndex(
+            (finditem) => finditem === String(evitem.id)
+          ) > -1
+      );
+      this.$set(this.actionList, index, item);
+    },
+
+    // 单项复选框选中/不选中
+
+    handleCheckedChange(checked, id, index, subIndex, item) {
+      // console.log(checked, id, index, subIndex);
+      if (checked) {
+        // 选中时检查pid的选中状态
+        this.actionList[index].children[subIndex].checkList.indexOf(String(id)) == -1 &&
+          this.actionList[index].children[subIndex].checkList.push(String(id));
+      } else {
+        const find = this.actionList[index].children[subIndex].checkList.findIndex(
+          (e) => e == id
+        );
+        if (find > -1) {
+          this.actionList[index].children[subIndex].checkList.splice(find, 1);
+        }
+        this.actionList[index].children[subIndex].checkAll = false;
+      }
+      this.$set(this.actionList, index, item);
+      // console.log(this.actionList[index].children[subIndex]);
+    },
+    // 单项复选框选中/不选中
+    handleFieldChange(checked, id, index, subIndex, item) {
+      // console.log(checked, id, index, subIndex);
+      if (checked) {
+        // 选中时检查pid的选中状态
+        this.actionList[index].children[subIndex].fieldList.indexOf(String(id)) == -1 &&
+          this.actionList[index].children[subIndex].fieldList.push(String(id));
+      } else {
+        const find = this.actionList[index].children[subIndex].fieldList.findIndex(
+          (e) => e == id
+        );
+        if (find > -1) {
+          this.actionList[index].children[subIndex].fieldList.splice(find, 1);
+        }
+        this.actionList[index].children[subIndex].fieldAll = false;
+      }
+      this.$set(this.actionList, index, item);
+      // console.log(this.actionList[index].children[subIndex]);
+    },
+    // 切换角色
+    switchRoleHandle(item) {
+      this.roleActive = Object.assign({}, item);
+      this.$nextTick(async () => {
+        await this.refreshRoleDetail(String(item.id));
+      });
+    },
+    // 保存
+    async save() {
+      this.action_data = []; // 字段数据
+      this.action = []; // 功能数据
+      let arr = [];
+      this.actionList.forEach((x) => {
+        x.children.forEach((y) => {
+          this.action_data.push(...y.fieldList);
+          this.action.push(...y.checkList);
+          if (String(y.is_private_change) === "1") {
+            arr.push(String(y.id));
+          }
+        });
+      });
+
+      // this.action_data.length === 0 || 和字段
+      if (this.action.length === 0) {
+        this.$message.warning("请选择功能!");
+      } else {
+        const model = {
+          role_id: this.roleActive.id,
+          // role_name: this.ruleForm.role_name,
+          // level: "2",
+          action: this.action,
+          // action_data: this.action_data,
+          // private_data: arr,
+          // private_field: this.private_field.split(','),
+          // is_allow_see_price: this.ruleForm.is_allow_see_price,
+          // relaComNo: this.currentCompany,
+        };
+
+        const loadding = this.$loading();
+        const res = await asyncRequest.update(model);
+        if (res && res.code === 1) {
+          this.$notify.success({
+            title: "保存成功!",
+            message: "",
+          });
+        }
+        loadding.close();
+      }
+    },
+    // 刷新角色详情
+    async refreshRoleDetail(roleid) {
+      this.isBtnDisabled = true;
+
+      const res = await asyncRequest.detail({ role_id: roleid });
+
+      if (res && res.code === 1 && res.data) {
+        let resD = res.data
+        this.action = res.data.action
+        this.ruleForm = resD;
+
+        this.refreshRoleCheckAllStatus();
+      } 
+      this.isBtnDisabled = false;
+    },
+    // 初始化功能权限列表
+    async initactionList() {
+      this.loading = true
+      const res = await asyncRequest.actionList({});
+      if (res && res.code === 1 && res.data) {
+        this.rules = this.recursionFilterActionList(res.data);
+        await this.initRoleList();
+      }
+
+      this.loading = false;
+    },
+    // 初始化角色列表
+    async initRoleList() {
+      const res = await asyncRequest.getRole({});
+      if (res && res.code === 1 && res.data) {
+        this.roleList = [].concat(res.data);
+        if (this.roleList.length > 0) {
+          await this.switchRoleHandle(this.roleList[0]);
+        }
+      }
+    },
+    // 刷新选择状态
+    refreshRoleCheckAllStatus() {
+      const list = JSON.parse(JSON.stringify(this.rules));
+      let arr = list.filter((item) => item.children && item.children.length > 0);
+      arr = arr.map((x) => {
+        x.children.map((y) => {
+          y.checkAll = false;
+          y.checkList = [];
+          y.fieldAll = false;
+          y.fieldList = [];
+          y.is_private_change = "0";
+          if (String(y.is_private) === "0") {
+            y.private = [];
+          } else {
+            y.private = [
+              {
+                id: "0",
+                label: "公有数据",
+              },
+              {
+                id: "1",
+                label: "私有数据",
+              },
+            ];
+          }
+          return y;
+        });
+        return x;
+      });
+      this.actionList = arr;
+      this.actionList.forEach((x, xi) => {
+        if (x.children && x.children.length > 0) {
+          x.children.forEach((y, yi) => {
+            let id = y.id;
+            if (y.action && y.action.length > 0) {
+              y.action.forEach((z) => {
+                const Aindex = this.action.findIndex((a) => String(a) === String(z.id));
+                if (Aindex !== -1) {
+                  y.checkList.push(this.action[Aindex]);
+                }
+                if (y.action.length === y.checkList.length) {
+                  y.checkAll = true;
+                }
+              });
+            }
+            if (y.action_data && y.action_data.length > 0) {
+              y.action_data.map((z) => {
+                const Bindex = this.action_data.findIndex((a) => String(a) === String(z.id));
+                if (Bindex !== -1) {
+                  y.fieldList.push(this.action_data[Bindex]);
+                }
+              });
+              if (y.action_data.length === y.fieldList.length) {
+                y.fieldAll = true;
+              }
+            }
+            if (y.private && y.private.length === 2) {
+              let Cindex = this.private_data.findIndex((a) => String(a) === String(y.id));
+              if (Cindex !== -1) {
+                y.is_private_change = "1";
+              } else {
+                y.is_private_change = "0";
+              }
+            } else {
+              y.is_private_change = "0";
+            }
+          });
+        }
+
+        console.log(this.actionList)
+        this.$set(this.actionList, xi, x);
+      });
+    },
+  },
+};
+</script>
+<style lang="scss" scoped>
+@import "~@/styles/mixin.scss";
+.action {
+  position: relative;
+  width: 100%;
+  height: 100%;
+  overflow: hidden;
+
+  .action_show_box {
+    // position: relative;
+    // height: calc(100% - 50px);
+    // min-height: calc(100% - 50px);
+
+    display: relative;
+    width: 100%;
+    height: calc(100vh - 50px);
+    overflow: hidden;
+    text-align: left;
+    //左侧
+    .role-list {
+      height: 100%;
+      overflow-y: auto;
+      width: 200px;
+      padding: 8px 16px;
+      min-height: 100%;
+      flex-shrink: 0;
+      border-right: 2px solid #dfe6ec;
+      @include scrollBar();
+      &::after {
+        content: "";
+        position: absolute;
+        top: 0;
+        right: 0;
+        height: 100%;
+        width: 2px;
+        background-color: #e4e7ed;
+        z-index: 1;
+      }
+      .role-list__title {
+        color: #b4b6c0;
+        line-height: 32px;
+      }
+      .role-list__item {
+        position: relative;
+        white-space: nowrap;
+        text-overflow: ellipsis;
+        overflow: hidden;
+        height: 32px;
+        line-height: 32px;
+        padding-left: 8px;
+        color: rgb(48, 49, 51);
+        cursor: pointer;
+        i {
+          position: absolute;
+          right: 0;
+          line-height: 32px;
+        }
+      }
+      .role-list__item.active {
+        color: #6954f0;
+        background: #f7f7f7;
+      }
+    }
+    //右侧
+    .rule-view {
+      height: calc(100% - 50px);
+      width: calc(100% - 200px);
+      overflow-y: auto;
+      @include scrollBar();
+      // padding: 0 0 0 16px;
+      .ffff {
+        width: 100%;
+        display: flex;
+        align-items: stretch;
+        .ftitle {
+          width: 110px;
+          text-align: center;
+          border-right: 1px solid #dfe6ec;
+          border-bottom: 1px solid #dfe6ec;
+          padding: 12px 14px;
+          display: flex;
+          align-items: center;
+          span {
+            display: inline-block;
+            width: 100%;
+            font-size: 17px;
+            text-align: center;
+            color: #97a8be;
+          }
+        }
+        .fbody {
+          width: calc(100% - 110px);
+          .fbody-item {
+            border-right: 1px solid #dfe6ec;
+            border-bottom: 1px solid #dfe6ec;
+
+            .stitle {
+              padding: 18px 18px 12px 18px;
+              border-bottom: 1px dashed #dfe6ec;
+              font-size: 14px;
+              color: #97a8be;
+              ._h2 {
+                display: inline-block;
+                // width: 100px;
+              }
+            }
+            .scheck {
+              padding: 15px 0 10px 0;
+              display: flex;
+              width: 100%;
+              .checkAll {
+                width: 140px;
+                text-align: right;
+                padding: 0 35px 0 0;
+              }
+              .checkItem {
+                width: calc(100% - 140px);
+              }
+            }
+            .sfield {
+              padding: 0 0 10px 0;
+              display: flex;
+              width: 100%;
+              .checkAll {
+                width: 140px;
+                text-align: right;
+                padding: 0 35px 0 0;
+              }
+              .checkItem {
+                width: calc(100% - 140px);
+              }
+            }
+          }
+        }
+        // .rule-list {
+        //   height: 100%;
+        //   overflow-y: auto;
+        //   padding: 0 0 80px 0;
+        //   .rule-title {
+        //     .title {
+        //       font-size: 20px;
+        //       color: #333;
+        //     }
+        //     .desc {
+        //       margin: 10px 0;
+        //       font-size: 12px;
+        //       color: #999;
+        //     }
+        //   }
+        //   .rule-item {
+        //     .title {
+        //       margin: 30px 30px 10px 0;
+        //       font-size: 18px;
+        //       padding-bottom: 12px;
+        //       border-bottom: 1px solid #eee;
+        //       color: #333;
+        //       .el-checkbox {
+        //         margin-left: 10px;
+        //       }
+        //     }
+        //     .el-checkbox-group {
+        //       margin: 10px 30px 30px 0;
+        //       .el-checkbox {
+        //         line-height: 30px;
+        //       }
+        //       .children-checkbox-hr {
+        //         margin: 8px 0;
+        //         border: none;
+        //         border-top: 2px dotted #eee;
+        //       }
+        //     }
+        //   }
+        // }
+      }
+    }
+    .rule-bottom {
+      padding: 10px 18px 8px 0;
+      background: #fff;
+      width: calc(100% - 200px);
+      position: absolute;
+      text-align: right;
+      bottom: 0;
+      right: 0;
+      &::before {
+        content: "";
+        position: absolute;
+        top: 0;
+        right: 0;
+        height: 2px;
+        width: 100%;
+        background-color: #e4e7ed;
+        z-index: 1;
+      }
+    }
+  }
+}
+</style>

+ 0 - 0
src/views/system/operationAccount/运营账号管理 → src/views/system/action/功能权限


+ 306 - 0
src/views/system/button/addEdit.vue

@@ -0,0 +1,306 @@
+<template>
+  <el-dialog
+    v-loading="loading"
+    :title="title"
+    :center="true"
+    align="left"
+    top="10vh"
+    width="750px"
+    :close-on-click-modal="false"
+    :visible.sync="showModelThis"
+    element-loading-text="拼命加载中"
+    element-loading-spinner="el-icon-loading"
+    element-loading-background="rgba(0, 0, 0, 0.8)"
+    @close="showModelThis = false"
+  >
+    <el-card style="margin-top: -20px">
+      <el-row :gutter="10">
+        <el-col :span="24">
+          <el-form
+            ref="ruleForm"
+            :model="ruleForm"
+            status-icon
+            :size="'mini'"
+            :rules="rules"
+            label-width="80px"
+            class="demo-ruleForm"
+          >
+            <el-row style="margin-bottom:20px">
+              <el-col :span="24">
+                <el-form-item label="功能编号" prop="action_code">
+                  <el-input
+                    v-model="ruleForm.action_code"
+                    :placeholder="'功能编号'"
+                    maxlength="11"
+                    :disabled="isDetail && id !== 'add'"
+                  />
+                </el-form-item>
+              </el-col>
+
+              <el-col :span="24">
+                <el-form-item label="功能名称" prop="action_name">
+                  <el-input
+                    v-model="ruleForm.action_name"
+                    :placeholder="'功能名称'"
+                    :disabled="isDetail && id !== 'add'"
+                    maxlength="100"
+                  />
+                </el-form-item>
+              </el-col>
+
+
+              <el-col :span="24">
+                <el-form-item label="功能描述" prop="action_desc">
+                  <el-input 
+                    size="mini"
+                    style="width:100%" 
+                    type="textarea"
+                    :disabled="isDetail &&id !== 'add'" 
+                    v-model="ruleForm.action_desc" 
+                    placeholder="功能描述"
+                  />
+                </el-form-item>
+              </el-col>
+            </el-row>
+          </el-form>
+        </el-col>
+        <el-col :span="6" class="bottom-btn">
+          <el-button v-if="!isDetail ||  id === 'add'" type="primary" @click="submitForm" :size="'mini'"
+            >保 存
+          </el-button>
+          <el-button @click="showModelThis = false" :size="'mini'">{{
+            isDetail && id !== 'add' ? "关 闭" : "取 消"
+          }}</el-button>
+        </el-col>
+      </el-row>
+    </el-card>
+  </el-dialog>
+</template>
+<script>
+import asyncRequest from "@/apis/service/system/button";
+import resToken from "@/mixins/resToken";
+/**
+ * @props 
+ *  action_name 功能名称
+ *  action_code 功能编号
+ *  action_desc 功能描述
+*/
+
+export default {
+  name: "Account",
+  props: ["showModel", "sitem" ,"id", "isDetail"],
+  mixins: [resToken],
+  data() {
+    return {
+      roleList: [],
+      loading: false,
+      title: "添加账号",
+      organizeList: [],
+      showModelThis: this.showModel,
+      coptions: [],
+      is_mainoptions: [],
+      isIndeterminate: false,
+      ruleForm: {
+        action_name: "", // 功能名称
+        action_code: "", //功能编号
+        action_desc:"",
+        role_id: "", //角色id
+      },
+      platformoptions: [],
+      rules: {
+        action_name: [
+          {
+            required: true,
+            trigger: "blur",
+            message:"请输入按钮编号"
+          },
+        ],
+        action_code: [
+          {
+            required: true,
+            trigger: "blur",
+            message:"请输入按钮名称"
+          },
+        ],
+      },
+    };
+  },
+  watch: {
+    showModel: function (val) {
+      this.showModelThis = val;
+      if (val) {
+        this.initForm();
+      }
+    },
+    showModelThis(val) {
+      if (!val) {
+        this.$emit("cancel");
+      }
+    },
+  },
+  mounted() {},
+  methods: {
+    itemidChange(e) {
+      this.ruleForm.itemid = e;
+      this.$refs.ruleForm.validateField("itemid");
+    },
+    async initForm() {
+      this.loading = true;
+
+      await this.resetForm();
+      if (this.id === "add") {
+        this.title = "添加功能";
+        this.rulesThis = this.rules;
+      } else {
+        if (this.isDetail) {
+          this.title = "功能详情";
+          this.rulesThis = {};
+        } else {
+          this.title = "修改功能";
+          this.rulesThis = this.rules;
+        }
+      }
+      this.loading = false;
+    },
+
+    async getClist() {
+      this.organizeList = [];
+      const { code, data, message } = await asyncRequest.getClist({
+        size: 10000,
+      });
+      if (code === 0) {
+        this.organizeList = data;
+        this.recursion(this.organizeList);
+      } else if (code >= 100 && code <= 104) {
+        await this.logout();
+      } else {
+        this.$message.warning(message);
+      }
+    },
+    handleCheckedCitiesChange(value) {
+      console.log(value);
+      let checkedCount = value.length;
+      this.ruleForm.is_all = checkedCount === this.coptions.length;
+      this.isIndeterminate = checkedCount > 0 && checkedCount < this.coptions.length;
+    },
+    recursion(list) {
+      list.map((v) => {
+        if (v && Array.isArray(v.child)) {
+          v.value = v.id + "";
+          v.label = v.name;
+          if (v.child.length === 0) {
+            delete v["child"];
+          } else {
+            this.recursion(v.child);
+          }
+        }
+        return v;
+      });
+    },
+    async getRole() {
+      const model = {
+        status: "", // 状态
+        action_desc: "", // 姓名
+        role_name: "",
+      };
+      const res = await asyncRequest.getRole(model);
+      if (res && res.code === 0 && res.data) {
+        this.roleList = res.data;
+        this.roleList.map((v1) => {
+          v1.id += "";
+          v1.status += "";
+          return v1;
+        });
+      }
+    },
+    async resetForm() {
+      // 重置
+      await this.$nextTick(() => {
+        if (this.$refs.ruleForm) {
+          this.$refs.ruleForm.resetFields();
+          this.$refs.ruleForm.clearValidate();
+          if (this.sitem) {
+            const {
+              action_name,
+              action_code,
+              action_desc,
+              id
+            } = this.sitem;
+
+            this.ruleForm = {
+              id,
+              action_name: action_name || "",
+              action_code: action_code || "",
+              action_desc: action_desc || ""
+            };
+
+          } else {
+            this.ruleForm = {
+              action_desc:"",
+              action_name: "", // 功能名称
+              action_code: ""
+            };
+          }
+        }
+      });
+    },
+    async submitForm() {
+      await this.$refs.ruleForm.validate(async (valid) => {
+        if (valid) {
+          if (!this.loading) {
+            this.loading = true;
+            const {
+              action_name,
+              action_code,
+              action_desc,
+              id
+            } = JSON.parse(JSON.stringify(this.ruleForm));
+
+
+            const model = {
+              action_name,
+              action_code,
+              action_desc,
+              id
+            };
+
+            let res = {};
+            if (this.id === "add") {
+              delete model["id"];
+              res = await asyncRequest.add(model);
+            } else {
+              res = await asyncRequest.update(model);
+            }
+            this.loading = false;
+            if (res && res.code === 1) {
+              const title = this.id === "add" ? "添加成功" : "修改成功";
+              this.$notify.success({
+                title,
+                message: "",
+              });
+              this.showModelThis = false;
+              // 刷新
+              this.$emit("refresh");
+            }
+          }
+        } else {
+          console.log("error submit!!");
+          return false;
+        }
+      });
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.account {
+  .bottom-btn {
+    position: absolute;
+    bottom: 0px;
+    right: 0;
+    text-align: right;
+    z-index: 2;
+  }
+}
+</style>

+ 410 - 0
src/views/system/button/index.vue

@@ -0,0 +1,410 @@
+<template>
+  <div class="account pagePadding">
+    <div>
+      <ex-table
+        v-loading="loading"
+        :table="table"
+        :data="tableData"
+        :columns="columns"
+        :page="pageInfo"
+        :size="size"
+        @page-curr-change="handlePageChange"
+        @page-size-change="handleSizeChange"
+        @screen-reset="
+          pageInfo.curr = 1;
+          parmValue.page = 1;
+          searchList();
+        "
+        @screen-submit="
+          pageInfo.curr = 1;
+          parmValue.page = 1;
+          searchList();
+        "
+      >
+        <template #table-header="{}">
+          <div style="width: 100%">
+            <el-row style="padding: 0 0 0 80px">
+              <el-col :span="24">
+                <el-col :span="4" style="width: 120px">
+                  <el-select
+                    :size="searchSize"
+                    v-model="parmValue.status"
+                    filterable
+                    clearable
+                    placeholder="状态"
+                    style="width: 100%"
+                    @change="
+                      pageInfo.curr = 1;
+                      parmValue.page = 1;
+                      searchList();
+                    "
+                  >
+                    <el-option
+                      v-for="item in statusList"
+                      :key="'status' + item.code"
+                      :label="item.name"
+                      :value="item.code"
+                    />
+                  </el-select>
+                </el-col>
+                <el-col :span="4" style="width: 150px; padding: 0 0 0 10px">
+                  <el-input
+                    :size="searchSize"
+                    v-model="parmValue.action_name"
+                    :maxlength="40"
+                    placeholder="功能名称"
+                  />
+                </el-col>
+                <el-col :span="4" style="width: 54px">
+                  <el-button
+                    :size="searchSize"
+                    type="primary"
+                    class="fr"
+                    icon="el-icon-search"
+                    @click="searchList"
+                /></el-col>
+                <el-col :span="24" style="width: 66px; float: right">
+                  <el-button
+                    v-if="powers.some((i) => i == '002')"
+                    type="success"
+                    :size="searchSize"
+                    style="float: right"
+                    @click="openModal('add', '0', 1, false, true, {})"
+                  >
+                    添加
+                  </el-button>
+                </el-col>
+                <el-col :span="3" style="width: 66px; float: right">
+                  <el-button
+                    :size="searchSize"
+                    type="primary"
+                    style="float: right; margin-left: 5px"
+                    @click="searchList"
+                  >
+                    刷新
+                  </el-button>
+                </el-col>
+              </el-col>
+            </el-row>
+          </div>
+        </template>
+
+        <template #depart_info="{ scope }">
+          <el-tag
+            style="margin: 0 3px 0 0"
+            :size="tablebtnSize"
+            type="''"
+            v-for="(ditem, dindex) in scope.row.depart_info"
+            :key="ditem + dindex"
+          >
+            <span v-for="(cItem, cindex) in ditem" :key="cItem + dindex + cindex">
+              <span v-show="cindex > 0">/</span><span>{{ cItem }}</span>
+            </span>
+            {{ ditem.name }}</el-tag
+          >
+        </template>
+        <template #status="{ scope }">
+          <el-tag
+            :size="tablebtnSize"
+            :type="scope.row.status == '0' ? 'warning' : ''"
+            v-text="
+              (statusOptions.find((item) => item.id == String(scope.row.status)) || {})
+                .label || '--'
+            "
+          ></el-tag>
+        </template>
+        <template #operation="{ scope }">
+          <el-tooltip
+            effect="dark"
+            content="详情"
+            placement="top"
+          >
+            <i
+              class="el-icon-view tb-icon"
+              @click="openModal(scope.row.id, true, scope.row)"
+            ></i>
+          </el-tooltip>
+          <el-tooltip
+            effect="dark"
+            content="修改"
+            placement="top"
+            v-if="Number(scope.row.status) === 1 && powers.some((i) => i == '005')"
+          >
+            <i
+              class="el-icon-edit tb-icon"
+              @click="openModal(scope.row.id, false, scope.row)"
+            ></i>
+          </el-tooltip>
+          <el-tooltip
+            v-if="Number(scope.row.status) === 1 && powers.some((i) => i == '004')"
+            effect="dark"
+            content="禁用"
+            placement="top"
+          >
+            <i
+              class="el-icon-video-pause tb-icon"
+              @click="statusConfirm(scope.row.id, scope.row.status)"
+            ></i>
+          </el-tooltip>
+          <el-tooltip
+            v-if="Number(scope.row.status) === 0 && powers.some((i) => i == '003')"
+            effect="dark"
+            content="启用"
+            placement="top"
+          >
+            <i
+              class="el-icon-video-play tb-icon"
+              @click="statusConfirm(scope.row.id, scope.row.status)"
+            ></i>
+          </el-tooltip>
+
+          <el-tooltip
+              v-if="powers.some((i) => i == '006')"
+              effect="dark"
+              content="删除"
+              placement="top"
+            >
+              <i class="el-icon-delete tb-icon" @click="deleteConfirm(scope.row)"></i>
+          </el-tooltip>
+        </template>
+      </ex-table>
+      <add-edit
+        :id="modelId"
+        :sitem="sitem"
+        :show-model="showModel"
+        :is-detail="isDetail"
+        @refresh="searchList"
+        @cancel="showModel = false"
+      />
+    </div>
+  </div>
+</template>
+<script>
+import asyncRequest from "@/apis/service/system/button";
+import mixinPage from "@/mixins/elPaginationHandle";
+import { statusList } from "@/assets/js/statusList";
+import resToken from "@/mixins/resToken";
+import { mapGetters } from "vuex";
+import addEdit from "./addEdit";
+
+export default {
+  name: "button",
+  components: {
+    addEdit,
+  },
+  mixins: [mixinPage, resToken],
+  computed: {
+    ...mapGetters(["tablebtnSize", "searchSize", "size"]),
+    powers() {
+      const { btnList } = this.$store.getters;
+      const tran = btnList.find((i) => i.menu_route == "button") || {};
+      const { action } = tran ?? {};
+      return action ?? [];
+    },
+  },
+  data() {
+    return {
+      sitem: null,
+      // 状态
+      statusOptions: [
+        { id: "0", label: "禁用" },
+        { id: "1", label: "启用" },
+      ],
+      statusList: statusList,
+      loading: true,
+      showModel: false,
+      isDetail: false,
+      modelId: 0,
+      parmValue: {
+        action_name: "", // 业务员名字
+        status: "", //
+        page: 1, // 页码
+        size: 15, // 每页显示条数
+      },
+      tableData: [],
+      passwordModel: false,
+      passwordModelId: 0,
+      isPasswordDetail: false,
+      // 表格 - 数据
+      tableData: [],
+      // 表格 - 参数
+      table: {
+        stripe: true,
+        border: true,
+        _defaultHeader_: ["setcol"],
+      },
+      // 表格 - 分页
+      pageInfo: {
+        size: 15,
+        curr: 1,
+        total: 0,
+      },
+      // 表格 - 列参数
+      columns: [
+        {
+          prop: "action_code",
+          label: "功能编号",
+          // width: "110px",
+        },
+        {
+          prop: "action_name",
+          label: "功能名称",
+          // width: "110px",
+        },
+        {
+          prop:'action_desc',
+          label:'功能描述'
+        },
+        {
+          prop: "status",
+          label: "状态",
+          _slot_: "status",
+          width: "70px",
+        },
+        {
+          prop: "addtime",
+          label: "创建时间",
+          // width: "140px",
+        },
+        {
+          prop: "",
+          label: "操作",
+          fixed: "right",
+          _noset_: true,
+          width: "140px",
+          _slot_: "operation",
+        },
+      ],
+    };
+  },
+  mounted() {
+    this.searchList();
+  },
+  methods: {
+    restSearch() {
+      this.parmValue = {
+        action_name: "", // 功能名称
+        status: "", //
+        page: 1, // 页码
+        size: 15, // 每页显示条数
+      };
+      // 表格 - 分页
+      this.pageInfo = {
+        size: 15,
+        curr: 1,
+        total: 0,
+      };
+      this.searchList();
+    },
+
+    openModal(id, isDetail, sitem) {
+      this.showModel = true;
+      this.modelId = id;
+      this.isDetail = isDetail;
+      this.sitem = sitem;
+    },
+
+    openPasswordModal(id, isDetail) {
+      this.passwordModel = true;
+      this.passwordModelId = id;
+      this.isPasswordDetail = isDetail;
+    },
+
+    async deleteById(id, status) {
+      await this.$confirm("确定要删除?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(async () => {
+          const model = {
+            id: id,
+            status: status + "" === "1" ? "0" : "1",
+          };
+
+          const res = await asyncRequest.status(model);
+          
+          if (res && res.code === 1) {
+            this.$notify.success({
+              title: "删除成功",
+              message: "",
+            });
+            this.searchList();
+          }
+        })
+        .catch(() => {
+          console.log("取消");
+        });
+    },
+    async searchList() {
+      this.loading = true;
+      const res = await asyncRequest.list({
+        ...this.parmValue,
+      });
+      
+      if (res && res.code === 1 && res.data) {
+       
+        this.tableData = res.data.list;
+        this.pageInfo.total = Number(res.data.count);
+      } else {
+        this.tableData = [];
+        this.pageInfo.total = 0;
+      }
+      this.loading = false;
+    },
+    async deleteConfirm({id, action_name}) {
+      await this.$confirm(`确定要删除 ${action_name} 按钮?`, {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(async () => {
+          this.loading = true;
+          const res = await asyncRequest.status({ id });
+          if (res && res.code === 1) {
+            this.loading = false;
+            this.$notify.success({
+              title: "删除成功!",
+              message: "",
+            });
+            await this.searchList();
+          }
+        })
+        .catch(() => {
+          console.log("取消");
+        });
+    },
+    async statusConfirm(id, status) {
+      await this.$confirm(`确定要改为${status + "" === "1" ? "禁用" : "启用"}?`, {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(async () => {
+          this.loading = true;
+          const model = {
+            id: id,
+            status: status + "" === "1" ? "0" : "1",
+          };
+          const res = await asyncRequest.status(model);
+          if (res && res.code === 1) {
+            this.loading = false;
+            this.$notify.success({
+              title: "状态修改成功!",
+              message: "",
+            });
+            await this.searchList();
+          }
+        })
+        .catch(() => {
+          console.log("取消");
+        });
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.account {
+}
+</style>

+ 0 - 0
src/views/system/button/按钮管理


+ 29 - 25
src/views/system/menuOperator/addEdit.vue

@@ -93,7 +93,7 @@
                 <template slot="prepend">views/</template>
               </el-input>
             </el-form-item>
-            <el-form-item v-if="level === 2" label="接口地址:" prop="menu_api">
+            <!-- <el-form-item v-if="level === 2" label="接口地址:" prop="menu_api">
               <el-input
                 v-model="ruleForm.menu_api"
                 :disabled="isDetail"
@@ -101,7 +101,7 @@
                 placeholder="页面对应的接口地址;例如:admin/cgdlist"
               >
               </el-input>
-            </el-form-item>
+            </el-form-item> -->
             <el-row>
               <el-col :span="12">
                 <el-form-item label="状态:" prop="is_show">
@@ -156,9 +156,6 @@
                 style="width: 100%"
               >
                 <el-option label="公共" value="0" />
-                <el-option label="超管" value="1" />
-                <el-option label="业务公司" value="2" />
-                <el-option label="供应商" value="3" />
               </el-select>
             </el-form-item>
           </el-col>
@@ -318,16 +315,6 @@ export default {
       this.$refs.ruleForm.validateField("img");
     },
     async initForm() {
-      console.log(
-        this.showModel,
-        this.id,
-        this.isDetail,
-        this.parentIds,
-        this.level,
-        this.isAdd,
-        this.type,
-        this.formData
-      );
       if (this.isAdd) {
         if (this.level === 1) {
           this.title = "添加一级菜单";
@@ -385,11 +372,11 @@ export default {
         menuid,
         action_name,
         action_code,
-        is_display,
+        is_private:is_display,
         level,
         menu_api,
       } = this.formData;
-
+      
       if (this.level !== 3) {
         // 重置
         this.ruleForm = {
@@ -469,6 +456,7 @@ export default {
       });
     },
     async submitForm() {
+      console.log(this.parentIds)
       if (this.loading) {
         return false;
       }
@@ -501,7 +489,7 @@ export default {
             is_show: is_show,
             weight: weight,
             route: route,
-            is_display: is_display,
+            private: is_display,
             url: component,
             menu_api: menu_api,
             action_code: code,
@@ -510,13 +498,29 @@ export default {
           };
 
           if (this.level === 1) {
+            model['menu_name'] = model['name']
+            model["menu_type"] = "1"
+            model['menu_img'] = model["img"]
+            model["menu_route"] = model["route"]
+            delete model["route"]
+            delete model["img"]
             delete model["pid"];
+            delete model["name"];
             delete model["menuid"];
             delete model["url"];
             delete model["action_code"];
             delete model["action_name"];
             delete model["status"];
           } else if (this.level === 2) {
+            model['menu_name'] = model['name']
+            model["menu_type"] = "2"
+            model['menu_img'] = model["img"]
+            model["menu_route"] = model["route"]
+            model["menu_url"] = model["url"]
+            delete model["route"]
+            delete model["url"]
+            delete model["img"]
+            delete model["name"];
             delete model["menuid"];
             delete model["action_code"];
             delete model["action_name"];
@@ -537,7 +541,11 @@ export default {
           }
 
           if (this.level < 3) {
-            res = await asyncRequest.update(model);
+            if(this.isAdd){
+              res = await asyncRequest.create(model);
+            }else{
+              res = await asyncRequest.update(model);
+            }
           } else {
             if (this.isAdd) {
               res = await asyncRequest.actionadd(model);
@@ -546,7 +554,7 @@ export default {
             }
           }
           this.loading = false;
-          if (res && res.code === 0) {
+          if (res && res.code === 1) {
             this.ruleForm = {};
             const title = this.isAdd ? "添加成功" : "修改成功";
             this.$notify.success({
@@ -558,11 +566,7 @@ export default {
             if (this.id === 0) {
               pids = "0";
             }
-            this.$emit("refresh", this.id, pids, this.level);
-          } else if (res && res.code >= 100 && res.code <= 104) {
-            await this.logout();
-          } else {
-            this.$message.warning(res.message);
+            this.$emit("refresh", this.id, pids, this.level, this.isAdd,this.parentIds);
           }
         } else {
           this.loading = false;

+ 61 - 36
src/views/system/menuOperator/index.vue

@@ -1,10 +1,10 @@
 <template>
   <div class="box pagePadding MenuOperator">
-    <div class="MenuOperator-main" v-if="powers.some((i) => i == '001')">
+    <div class="MenuOperator-main">
       <el-row class="MenuOperator-search clear" style="padding: 10px 0">
         <el-col :span="24" style="width: 66px; float: right">
           <el-button
-            v-if="powers.some((i) => i == '003')"
+             v-if="powers.some((i) => i == '002')"
             type="success"
             :size="searchSize"
             style="float: right"
@@ -19,20 +19,25 @@
             :size="searchSize"
             style="float: right; margin-left: 5px"
             @click="searchList"
-          >
+          > 
             刷新
           </el-button>
+          <!-- <el-button @click="handleExpand">展开</el-button> -->
         </el-col>
       </el-row>
+
       <div style="padding: 50px 0 0 0">
         <el-table
+          border
+          ref="table"
           :data="tableData"
           style="width: 100%; margin-bottom: 20px"
           row-key="id"
           v-loading="loading"
-          border
           :default-expand-all="false"
           size="mini"
+          lazy
+          :load="load"
           :tree-props="{ children: 'child', hasChildren: 'hasChildren' }"
         >
           <el-table-column prop="menu_name" label="菜单名称" width="180" />
@@ -67,7 +72,6 @@
           <el-table-column prop="address" label="操作" width="180">
             <template slot-scope="scope">
               <el-tooltip
-                v-if="powers.some((i) => i == '007')"
                 effect="dark"
                 content="详情"
                 placement="top"
@@ -88,10 +92,10 @@
                 ></i>
               </el-tooltip>
               <el-tooltip
-                v-if="powers.some((i) => i == '005')"
                 effect="dark"
                 content="修改"
                 placement="top"
+                v-if="powers.some((i) => i == '005')"
               >
                 <i
                   class="el-icon-edit tb-icon"
@@ -109,7 +113,7 @@
                 ></i>
               </el-tooltip>
               <el-tooltip
-                v-if="powers.some((i) => i == '004') && scope.row.status + '' === '1'"
+                v-if="scope.row.status + '' === '1' && powers.some((i) => i == '004')"
                 effect="dark"
                 content="禁用"
                 placement="top"
@@ -128,7 +132,7 @@
                 ></i>
               </el-tooltip>
               <el-tooltip
-                v-if="powers.some((i) => i == '004') && scope.row.status + '' === '0'"
+                v-if="scope.row.status + '' === '0' && powers.some((i) => i == '003')"
                 effect="dark"
                 content="启用"
                 placement="top"
@@ -147,7 +151,7 @@
                 ></i>
               </el-tooltip>
               <el-tooltip
-                v-if="powers.some((i) => i == '006')"
+                v-if="Number(scope.row.pid) === 0 && powers.some((i) => i == '006')"
                 effect="dark"
                 content="删除"
                 placement="top"
@@ -166,7 +170,7 @@
                 ></i>
               </el-tooltip>
               <el-tooltip
-                v-if="powers.some((i) => i == '003') && Number(scope.row.pid) === 0"
+                v-if="Number(scope.row.pid) === 0 && powers.some((i) => i == '002')"
                 effect="dark"
                 content="添加"
                 placement="top"
@@ -174,7 +178,7 @@
                 <i
                   class="el-icon-circle-plus-outline tb-icon"
                   size="mini"
-                  @click="openModal(0, scope.row.id, 2, false, true, {})"
+                  @click="openModal(0, scope.row.id, 2, false, true, {}, scope.row)"
                 ></i>
               </el-tooltip>
             </template>
@@ -195,9 +199,6 @@
         @cancel="showModel = false"
       />
     </div>
-    <div v-else>
-      <no-auth></no-auth>
-    </div>
   </div>
 </template>
 
@@ -226,6 +227,8 @@ export default {
   data() {
     return {
       // 状态
+      refreshId:0,
+      loadMap: new Map(),
       statusOptions: [
         { id: 0, label: "禁用" },
         { id: 1, label: "启用" },
@@ -255,6 +258,26 @@ export default {
     this.searchList();
   },
   methods: {
+    async load(row,treeNode,resolve){
+      console.log(row)
+      const { id: pid } = row
+      this.loadMap.set(pid,{ row, treeNode, resolve })
+      const { code, data } = await asyncRequest.list({pid});
+      if(code === 1) resolve(data.map(item => ({ ...item, hasChildren: false })))
+    },
+    reloadTree(pid){
+      pid = pid ? parseInt(pid) : 0;
+      if(pid === 0) return null
+      const result = this.loadMap.get(pid)
+      if(!result) return null
+      this.$refs.table.store.states.lazyTreeNodeMap[pid] = []
+        const {row, treeNode, resolve} = result
+        if(row.id === 0){
+          row.pid = row.id
+          row.id = 0
+        }
+      this.load(row,treeNode,resolve)
+    },
     openModal(id, parentIds, level, isDetail, isAdd, formData) {
       this.showModel = true;
       this.modelId = id;
@@ -264,11 +287,13 @@ export default {
       this.isAdd = isAdd;
       this.formData = formData;
     },
-    async submitRefresh(id, parentIds, level) {
-      if (level < 3) {
-        await this.searchList();
-      } else {
-        this.getchildList(parentIds);
+    async submitRefresh(_1,_2, level, isAdd,parentIds) {
+      if((level === 0 && isAdd)){
+        this.reloadTree(parentIds)
+      }else if(level === 2){
+        this.reloadTree(parentIds)
+      }else{
+        this.searchList()
       }
     },
     async changeStatus(id, parentIds, level, status) {
@@ -289,20 +314,18 @@ export default {
             res = await asyncRequest.menustatus(model);
           }
 
-          if (res && res.code === 0) {
+          if (res && res.code === 1) {
             this.$notify.success({
               title: "修改成功!",
               message: "",
             });
-            if (level === 3) {
-              this.getchildList(parentIds);
+
+            if (level === 0 && parentIds !== 0) {
+              this.reloadTree(parentIds)
             } else {
               await this.searchList();
             }
-          } else if (res && res.code >= 100 && res.code <= 104) {
-            await this.logout();
-          } else {
-            this.$message.warning(res.message);
+            
           }
         })
         .catch(() => {
@@ -310,6 +333,7 @@ export default {
         });
     },
     async deleteItem(id, parentIds, level, status) {
+      console.log(level,parentIds)
       await this.$confirm(`确定要删除?`, {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
@@ -326,18 +350,17 @@ export default {
             res = await asyncRequest.menudel(model);
           }
 
-          if (res && res.code === 0) {
+          if (res && res.code === 1) {
             this.$notify.success({
               title: "删除成功!",
               message: "",
             });
-            if (level === 3) {
-              this.getchildList(parentIds);
+
+            if (level === 0 && parentIds !== 0) {
+              this.reloadTree(parentIds)
             } else {
               await this.searchList();
             }
-          } else if (res && res.code >= 100 && res.code <= 104) {
-            await this.logout();
           }
         })
         .catch(() => {
@@ -374,8 +397,9 @@ export default {
       }
     },
     async getchildList(id) {
+      console.log(id)
       this.loading = true;
-      const res = await asyncRequest.actionList({ id: id });
+      const res = await asyncRequest.actionList({ menu_id: id });
       let tableData = [];
       if (res && res.code === 0 && res.data) {
         tableData = res.data;
@@ -432,10 +456,11 @@ export default {
       this.loading = true;
       const res = await asyncRequest.list({});
       this.tableData = [];
-      if (res && res.code === 0 && res.data) {
-        this.tableData = res.data;
-      } else if (res && res.code >= 100 && res.code <= 104) {
-        await this.logout();
+      if (res && res.code === 1 && res.data) {
+        this.tableData = res.data.map(item => ({
+          hasChildren:true,
+          ...item
+        }));
       } else {
         this.tableData = [];
       }

+ 60 - 18
src/views/system/operationAccount/addEdit.vue

@@ -26,8 +26,16 @@
             class="demo-ruleForm"
           >
             <el-row style="margin-bottom:20px">
+              <el-form-item prop="username" label="用户名" v-if="id === 'add'">
+                <el-input
+                  ßßsize="mini"
+                  v-model="ruleForm.username"
+                  placeholder="用户名"
+                 />
+              </el-form-item>
+
               <el-col :span="24">
-                <el-form-item label="账号名" prop="nickname">
+                <el-form-item label="昵称" prop="nickname">
                   <el-input
                     v-model="ruleForm.nickname"
                     :placeholder="'账号名'"
@@ -36,6 +44,18 @@
                   />
                 </el-form-item>
               </el-col>
+
+              <el-col :span="24">
+                <el-form-item label="密码" prop="password" v-if="id === 'add'">
+                  <el-input
+                    type="password"
+                    v-model="ruleForm.password"
+                    :placeholder="'密码'"
+                    :disabled="isDetail"
+                    maxlength="100"
+                  />
+                </el-form-item>
+              </el-col>
               
               <el-col :span="24">
                 <el-form-item label="手机号" prop="mobile">
@@ -48,14 +68,24 @@
                 </el-form-item>
               </el-col>
 
+              <el-col :span="24" v-if="id === 'add'">
+                <el-form-item label="邮箱" prop="email">
+                  <el-input
+                    v-model="ruleForm.email"
+                    :placeholder="'邮箱'"
+                    maxlength="11"
+                    :disabled="isDetail"
+                  />
+                </el-form-item>
+              </el-col>
 
-              <el-col :span="24">
+              <!-- <el-col :span="24">
                 <el-form-item label="角色等级" prop="level">
                   <el-select size="mini" style="width:100%" :disabled="isDetail" v-model="ruleForm.level" placeholder="角色等级">
                     <el-option />
                   </el-select>
                 </el-form-item>
-              </el-col>
+              </el-col> -->
             </el-row>
           </el-form>
         </el-col>
@@ -91,7 +121,7 @@ import {
 
 export default {
   name: "Account",
-  props: ["showModel", "id", "isDetail"],
+  props: ["showModel", "id", "isDetail", "sitem"],
   mixins: [resToken],
   data() {
     const validateusername = (rule, value, callback) => {
@@ -152,6 +182,8 @@ export default {
       is_mainoptions: [],
       isIndeterminate: false,
       ruleForm: {
+        password:"",
+        username:"",
         nickname: "", // 账号名
         mobile: "", //手机号
         role_id: "", //角色id
@@ -204,11 +236,8 @@ export default {
     async initForm() {
       this.loading = true;
 
-      if (this.id === "add") {
-        await this.resetForm();
-      } else {
-        await this.initData();
-      }
+      await this.resetForm();
+
       if (this.id === "add") {
         this.title = "添加账号";
         this.rulesThis = this.rules;
@@ -286,27 +315,38 @@ export default {
         this.$message.warning(message);
       }
     },
-    async resetForm(sitem) {
+    async resetForm() {
       // 重置
       await this.$nextTick(() => {
         if (this.$refs.ruleForm) {
           this.$refs.ruleForm.resetFields();
           this.$refs.ruleForm.clearValidate();
-          if (sitem) {
+          if (this.sitem) {
             const {
+              email,
+              password,
+              username,
               nickname,
               mobile,
               id
-            } = sitem;
+            } = this.sitem;
 
             this.ruleForm = {
               id,
+              email:email || "",
+              password:password || "",
+              username:username || "",
               nickname: nickname || "",
               mobile: mobile || ""
             };
 
+
+
           } else {
             this.ruleForm = {
+              email:"",
+              password:"",
+              username:"",
               nickname: "", // 账号名
               mobile: ""
             };
@@ -320,27 +360,33 @@ export default {
           if (!this.loading) {
             this.loading = true;
             const {
+              username,
               nickname,
+              password,
               mobile,
+              email,
               id
             } = JSON.parse(JSON.stringify(this.ruleForm));
 
 
             const model = {
+              password,
               nickname,
+              username,
               mobile,
+              email,
               id
             };
 
             let res = {};
             if (this.id === "add") {
               delete model["id"];
-              res = await asyncRequest.add(model);
+              res = await asyncRequest.register(model);
             } else {
               res = await asyncRequest.update(model);
             }
             this.loading = false;
-            if (res && res.code === 0) {
+            if (res && res.code === 1) {
               const title = this.id === "add" ? "添加成功" : "修改成功";
               this.$notify.success({
                 title,
@@ -349,10 +395,6 @@ export default {
               this.showModelThis = false;
               // 刷新
               this.$emit("refresh");
-            } else if (res && res.code >= 100 && res.code <= 104) {
-              await this.logout();
-            } else {
-              this.$message.warning(res.message);
             }
           }
         } else {

+ 92 - 0
src/views/system/operationAccount/components/setRoleModal.vue

@@ -0,0 +1,92 @@
+<template>
+  <el-dialog title="设置角色" :visible="visible" @close="handleClose" :close-on-click-modal="false"> 
+    <el-form label-width="80px" v-if="info" :rules="rules" :model="ruleForm" ref="ruleForm">
+      <el-form-item label="昵称">
+        <el-input disabled v-model="info.nickname" placeholder="昵称" />
+      </el-form-item>
+
+      <el-form-item label="角色" prop="role_id">
+        <el-radio-group v-model="ruleForm.role_id">
+          <el-radio v-for="role in roles" :label="role.id" :key="role.id">{{role.role_name}}</el-radio>
+        </el-radio-group>
+      </el-form-item>
+
+      <el-form-item class="flex-end">
+        <el-button :loading="loading" type="primary" size="mini" @click="onSubmit">保存</el-button>
+      </el-form-item>
+    </el-form>
+  </el-dialog>
+</template>
+
+<script>
+import asyncRequest from "@/apis/service/system/operationAccount";
+export default {
+  name:"SetRoleModal",
+  props:["info", "visible"],
+  computed:{
+    _visible:{
+      get(){
+        return this.visible
+      },
+      set(newVal){
+        this.$emit("update:visible", newVal)
+      }
+    }
+  },
+  watch:{
+    _visible:{
+      handler(newVal){
+        if(!newVal) return
+        const { role_id } = this.info
+        this.ruleForm.role_id = role_id
+      },
+      immediate:true
+    }
+  },
+  data(){
+    return {
+      loding:false,
+      roles: [],
+      ruleForm:{
+        role_id:""
+      },
+      rules:{
+        role_id:[
+          {
+            required:true,
+            trigger:'change',
+            message:'选择角色'
+          }
+        ]
+      }
+    }
+  },
+  mounted(){
+    this.requsetRoles()
+  },
+  methods:{
+    async onSubmit(){
+      try{
+        await this.$refs.ruleForm.validate()
+        this.loading = true
+        const response = await asyncRequest.setRole({ id: this.info.id, ...this.ruleForm })
+        this.loading = false
+        if(response.code === 1) {
+           this.$emit("refresh")
+           this._visible = false
+        }
+      }catch(err){
+        console.log(err)
+      }
+    },
+    handleClose(){
+      this.ruleForm = {role_id:""} 
+      this._visible = false
+    },
+    async requsetRoles(){
+      const { code, data } = await asyncRequest.roleQuery({})
+      if(code === 1) this.roles = data
+    }
+  }
+}
+</script>

+ 26 - 42
src/views/system/operationAccount/index.vue

@@ -1,6 +1,5 @@
 <template>
   <div class="account pagePadding">
-    <div v-if="powers.some((i) => i == '001')">
       <ex-table
         v-loading="loading"
         :table="table"
@@ -81,7 +80,8 @@
                     重置
                   </el-button>
                 </el-col>
-                <el-col :span="3" style="width: 66px; float: right">
+                <el-col :span="3" style="width: 125px; float: right">
+                  <el-button type="primary" size="mini"  @click="openModal('add', false, {})">注册</el-button>
                   <el-button
                     :size="searchSize"
                     type="primary"
@@ -121,17 +121,6 @@
           ></el-tag>
         </template>
         <template #operation="{ scope }">
-          <el-tooltip
-            v-if="powers.some((i) => i == '002')"
-            effect="dark"
-            content="重置密码"
-            placement="top"
-          >
-            <i
-              class="el-icon-refresh-left tb-icon"
-              @click="openPasswordModal(scope.row.id, false)"
-            ></i>
-          </el-tooltip>
           <el-tooltip
             v-if="powers.some((i) => i == '007')"
             effect="dark"
@@ -155,25 +144,13 @@
             ></i>
           </el-tooltip>
           <el-tooltip
-            v-if="powers.some((i) => i == '004') && scope.row.status === '1'"
-            effect="dark"
-            content="禁用"
-            placement="top"
-          >
-            <i
-              class="el-icon-video-pause tb-icon"
-              @click="statusConfirm(scope.row.id, scope.row.status)"
-            ></i>
-          </el-tooltip>
-          <el-tooltip
-            v-if="powers.some((i) => i == '004') && scope.row.status === '0'" 
             effect="dark"
-            content="启用"
+            content="设置角色"
             placement="top"
           >
             <i
-              class="el-icon-video-play tb-icon"
-              @click="statusConfirm(scope.row.id, scope.row.status)"
+              class="el-icon-setting tb-icon"
+              @click="openRoleModal(scope.row)"
             ></i>
           </el-tooltip>
         </template>
@@ -187,6 +164,12 @@
         @cancel="showModel = false"
       />
 
+      <set-role-modal 
+        :info="sitem"
+        :visible.sync="visible"
+        @refresh="searchList"    
+      />
+
       <reset-password
         :id="passwordModelId"
         :show-model="passwordModel"
@@ -195,25 +178,22 @@
         @cancel="passwordModel = false"
       />
     </div>
-    <div v-else>
-      <no-auth></no-auth>
-    </div>
   </div>
 </template>
 <script>
 import asyncRequest from "@/apis/service/system/operationAccount";
 import mixinPage from "@/mixins/elPaginationHandle";
 import { statusList } from "@/assets/js/statusList";
-import resetPassword from "./resetPassword";
 import resToken from "@/mixins/resToken";
 import { mapGetters } from "vuex";
 import addEdit from "./addEdit";
+import SetRoleModal from "./components/setRoleModal.vue"
 
 export default {
   name: "operationAccount",
   components: {
     addEdit,
-    resetPassword,
+    SetRoleModal
   },
   mixins: [mixinPage, resToken],
   computed: {
@@ -227,6 +207,7 @@ export default {
   },
   data() {
     return {
+      visible:false,
       sitem: null,
       // 状态
       statusOptions: [
@@ -267,9 +248,13 @@ export default {
       columns: [
         {
           prop: "nickname",
-          label: "账号名",
+          label: "昵称",
           // width: "110px",
         },
+        {
+          prop:'role_name',
+          label:'角色'
+        },
         {
           prop: "mobile",
           label: "联系电话",
@@ -301,6 +286,10 @@ export default {
     this.searchList();
   },
   methods: {
+    openRoleModal(sitem){
+      this.sitem = sitem
+      this.visible = true
+    },
     restSearch() {
       this.parmValue = {
         nickname: "", // 账号名
@@ -364,17 +353,12 @@ export default {
       this.loading = true;
       const res = await asyncRequest.list({
         ...this.parmValue,
-        level: "1",
       });
-      if (res && res.code === 0 && res.data) {
+      if (res && res.code === 1 && res.data) {
         this.tableData = res.data.list;
         this.pageInfo.total = Number(res.data.count);
-      } else if (res && res.code >= 100 && res.code <= 104) {
-        await this.logout();
-      } else {
-        this.tableData = [];
-        this.pageInfo.total = 0;
       }
+
       this.loading = false;
     },
     async statusConfirm(id, status) {
@@ -401,7 +385,7 @@ export default {
             await this.logout();
           } else {
             this.$message.warning(res.message);
-          }
+          } 
         })
         .catch(() => {
           console.log("取消");

+ 0 - 0
src/views/system/operationAccount/账号管理


+ 838 - 0
src/views/system/role/addEdit.vue

@@ -0,0 +1,838 @@
+<template>
+  <el-dialog
+    v-loading="loading"
+    :title="title"
+    :center="true"
+    align="left"
+    top="5vh"
+    width="600px"
+    :close-on-click-modal="false"
+    :visible.sync="showModelThis"
+    element-loading-text="拼命加载中"
+    element-loading-spinner="el-icon-loading"
+    element-loading-background="rgba(0, 0, 0, 0.8)"
+    @close="showModelThis = false"
+  >
+    <el-card style="margin-top: -20px">
+      <el-row :gutter="10">
+        <el-form
+          ref="ruleForm"
+          :model="ruleForm"
+          status-icon
+          :size="'mini'"
+          :rules="rulesThis"
+          label-width="80px"
+          class="demo-ruleForm"
+        >
+          <el-col :span="24">
+            <el-form-item label="角色名称" prop="role_name">
+              <el-input
+                v-model="ruleForm.role_name"
+                :disabled="isDetail"
+                maxlength="50"
+                placeholder="角色名称"
+              />
+            </el-form-item>
+          </el-col>
+          <!-- <el-col :span="6">
+            <el-form-item label="角色等级" prop="level">
+              <el-select
+                v-model="ruleForm.level"
+                filterable
+                disabled
+                placeholder="请选择角色等级"
+                style="width: 100%"
+              >
+                <el-option
+                  v-for="item in roleLevel"
+                  :key="'ruleid' + item.code"
+                  :label="item.name"
+                  :value="item.code"
+                />
+              </el-select>
+            </el-form-item>
+          </el-col> -->
+          <!--
+          <el-col :span="12">
+            <el-form-item label="是否允许查看价格" label-width="130px">
+              <el-select v-model="ruleForm.is_allow_see_price" :disabled="isDetail" placeholder="是否允许查看价格">
+                <el-option value="1" label="允许" />
+                <el-option value="0" label="不允许" />
+              </el-select>
+            </el-form-item>
+          </el-col> -->
+
+          <!-- <div class="quanxian-main">
+            <div class="quanxian-title">
+              <span style="color: #ff8888">*</span><span
+                style="
+                  font-size: 14px;
+                  color: #606266;
+                  line-height: 40px;
+                  padding: 0 12px 0 0;
+                  font-weight: 700;
+                "
+              >功能权限</span>
+            </div>
+            <div class="rule-view">
+              <div class="rule-list">
+                <el-row
+                  v-for="(item, index) in actionList"
+                  :key="'menu' + item.id + index"
+                >
+                  <el-col
+                    v-if="item.children && item.children.length > 0"
+                    class="ffff"
+                    :span="24"
+                  >
+                    <div class="ftitle">
+                      <span>{{ item.menu_name }}</span>
+                    </div>
+                    <div class="fbody">
+                      <div
+                        v-for="(subItem, subIndex) in item.children"
+                        :key="'yemian' + subItem.id + subIndex"
+                        class="fbody-item"
+                      >
+                        <template
+                          v-if="
+                            !(
+                              subItem.action &&
+                              subItem.action.length === 0 &&
+                              subItem.action_data &&
+                              subItem.action_data.length === 0
+                            )
+                          "
+                        >
+                          <div class="stitle">
+                            <span class="_h2">{{ subItem.menu_name }}</span>
+                            <el-radio-group
+                              v-if="
+                                subItem &&
+                                  subItem.private &&
+                                  subItem.private.length === 2
+                              "
+                              v-model="subItem.is_private_change"
+                              style="margin: 0 0 0 20px"
+                              size="mini"
+                              :disabled="isDetail"
+                            >
+                              <el-radio-button
+                                v-for="(radioN, ri) in subItem.private"
+                                :key="radioN.label + ri"
+                                :disabled="isDetail"
+                                :label="String(radioN.id)"
+                              >{{ radioN.label }}</el-radio-button>
+                            </el-radio-group>
+                          </div>
+                          <div
+                            v-if="subItem.action && subItem.action.length > 0"
+                            class="scheck"
+                          >
+                            <div class="checkAll">
+                              <el-checkbox
+                                v-model="subItem.checkAll"
+                                :disabled="isDetail"
+                                :indeterminate="indeterminateCheck(subItem)"
+                                @change="
+                                  handleCheckAllChange(
+                                    $event,
+                                    index,
+                                    item,
+                                    subIndex
+                                  )
+                                "
+                              >功能全选</el-checkbox>
+                            </div>
+                            <div class="checkItem">
+                              <el-checkbox-group
+                                v-model="subItem.checkList"
+                                :disabled="isDetail"
+                                @change="
+                                  handleCheckedGroupChange(
+                                    $event,
+                                    index,
+                                    item,
+                                    subIndex
+                                  )
+                                "
+                              >
+                                <template v-for="children in subItem.action">
+                                  <el-checkbox
+                                    :key="'checkItem' + children.id"
+                                    :disabled="isDetail"
+                                    :label="String(children.id)"
+                                    @change="
+                                      handleCheckedChange(
+                                        $event,
+                                        String(children.id),
+                                        index,
+                                        subIndex,
+                                        item
+                                      )
+                                    "
+                                  >{{ children.action_name }}</el-checkbox>
+                                </template>
+                              </el-checkbox-group>
+                            </div>
+                          </div>
+                          <div
+                            v-if="
+                              subItem.action_data &&
+                                subItem.action_data.length > 0
+                            "
+                            class="sfield"
+                          >
+                            <div class="checkAll">
+                              <el-checkbox
+                                v-model="subItem.fieldAll"
+                                :disabled="isDetail"
+                                :indeterminate="indeterminateField(subItem)"
+                                @change="
+                                  handleFieldAllChange(
+                                    $event,
+                                    index,
+                                    item,
+                                    subIndex
+                                  )
+                                "
+                              >字段全选</el-checkbox>
+                            </div>
+                            <div class="checkItem">
+                              <el-checkbox-group
+                                v-model="subItem.fieldList"
+                                :disabled="isDetail"
+                                @change="
+                                  handleFieldGroupChange(
+                                    $event,
+                                    index,
+                                    item,
+                                    subIndex
+                                  )
+                                "
+                              >
+                                <template
+                                  v-for="children in subItem.action_data"
+                                >
+                                  <el-checkbox
+                                    :key="'FieldItem' + children.id"
+                                    :label="String(children.id)"
+                                    :disabled="isDetail"
+                                    @change="
+                                      handleFieldChange(
+                                        $event,
+                                        String(children.id),
+                                        index,
+                                        subIndex,
+                                        item
+                                      )
+                                    "
+                                  >{{ children.field_name }}</el-checkbox>
+                                </template>
+                              </el-checkbox-group>
+                            </div>
+                          </div>
+                        </template>
+                      </div>
+                    </div>
+                  </el-col>
+                </el-row>
+              </div>
+            </div>
+          </div> -->
+        </el-form>
+        <el-col :span="24" style="text-align: right;margin-top:10px">
+          <el-button
+            v-if="!isDetail"
+            type="primary"
+            :size="'mini'"
+            @click="submitForm"
+          >保 存
+          </el-button>
+          <el-button :size="'mini'" @click="showModelThis = false">{{
+            isDetail ? "关 闭" : "取 消"
+          }}</el-button>
+        </el-col>
+      </el-row>
+    </el-card>
+  </el-dialog>
+</template>
+<script>
+import asyncRequest from '@/apis/service/system/role'
+import roleLevel from '@/assets/js/roleLevel'
+import { isChinese, isEmoticon } from '@/utils/validate'
+import resToken from '@/mixins/resToken'
+import { mapState } from 'vuex'
+
+export default {
+  name: 'Role',
+  mixins: [resToken],
+  props: ['showModel', 'id', 'isDetail', 'sitem'],
+  data() {
+    const validatename = (rule, value, callback) => {
+      if (value === '') {
+        callback(new Error('角色名称不能为空!'))
+      } else {
+        if (value.lenght < 2 || value.lenght > 10) {
+          callback(new Error('角色名称规则为2~10位汉字!'))
+        } else if (!isChinese(value)) {
+          callback(new Error('角色名称规则为2~10位汉字!'))
+        } else if (isEmoticon(value)) {
+          callback(new Error('角色名称规则为2~10位汉字!'))
+        } else {
+          callback()
+        }
+      }
+    }
+    return {
+      loading: false,
+      title: '添加角色',
+      private_data: [], // 私有数据菜单ID
+      showModelThis: this.showModel,
+      roleLevel: roleLevel,
+      ruleForm: {
+        role_name: '',
+        level: '2',
+        private_field: [],
+        is_allow_see_price: '1'
+      },
+      action_data: [], // 字段数据
+      action: [], // 功能数据
+      // 当前角色
+      roleActive: {
+        rules: []
+      },
+      // 角色列表
+      roleList: [],
+      // 功能权限列表
+      ruleList: [],
+      dataList: [],
+      actionList: [],
+      rulesThis: this.rules,
+      rules: {
+        private_field: [
+          {
+            type: 'array',
+            required: true,
+            message: '请选择关键字段权限',
+            trigger: 'change'
+          }
+        ],
+        role_name: [
+          {
+            required: true,
+            validator: validatename,
+            trigger: 'blur'
+          }
+        ]
+        // level: [
+        //   { required: true, message: '请选择角色等级', trigger: 'change' }
+        // ]
+      }
+    }
+  },
+  computed: {
+    ...mapState({
+      currentCompany: (state) => state.user.currentCompany
+    }),
+    indeterminateCheck() {
+      return (item) => {
+        // 选中子节点的数量
+        const selectItemLength = item.action.filter(
+          (filitem) =>
+            item.checkList.findIndex((finditem) => String(finditem) === String(filitem.id)) > -1
+        ).length
+        // 未选中子节点的数量
+        const noSlectItemLength = item.action.filter(
+          (filitem) =>
+            item.checkList.findIndex((finditem) => String(finditem) === String(filitem.id)) ==
+            -1
+        ).length
+        // // 当前节点的index
+        // 存在选中子节点且存在未选中子节点为中间态
+        return selectItemLength > 0 && noSlectItemLength > 0
+      }
+    },
+    indeterminateField() {
+      return (item) => {
+        // 选中子节点的数量
+        const selectItemLength = item.action_data.filter(
+          (filitem) =>
+            item.fieldList.findIndex((finditem) => String(finditem) === String(filitem.id)) > -1
+        ).length
+        // 未选中子节点的数量
+        const noSlectItemLength = item.action_data.filter(
+          (filitem) =>
+            item.fieldList.findIndex((finditem) => String(finditem) === String(filitem.id)) ==
+            -1
+        ).length
+        // // 当前节点的index
+        // 存在选中子节点且存在未选中子节点为中间态
+        return selectItemLength > 0 && noSlectItemLength > 0
+      }
+    }
+  },
+  watch: {
+    showModel: function(val) {
+      this.showModelThis = val
+      if (val) {
+        this.initForm()
+      }
+    },
+    showModelThis(val) {
+      if (!val) {
+        this.$emit('cancel')
+      }
+    }
+  },
+  methods: {
+    // 全选/全不选
+    handleCheckAllChange(checkAll, index, item, subIndex) {
+      this.actionList[index].children[subIndex].checkAll = checkAll
+      this.$set(this.actionList, index, item)
+      this.actionList[index].children[subIndex].action.forEach((element) => {
+        const findindex = this.actionList[index].children[
+          subIndex
+        ].checkList.findIndex((findItem) => String(findItem) === String(element.id))
+        if (checkAll && findindex == -1) {
+          this.actionList[index].children[subIndex].checkList.push(String(element.id))
+        } else if (!checkAll && findindex > -1) {
+          this.actionList[index].children[subIndex].checkList.splice(findindex, 1)
+        }
+      })
+    },
+    // 全选/全不选
+    handleFieldAllChange(fieldAll, index, item, subIndex) {
+      this.actionList[index].children[subIndex].fieldAll = fieldAll
+      this.$set(this.actionList, index, item)
+      this.actionList[index].children[subIndex].action_data.forEach((element) => {
+        const findindex = this.actionList[index].children[
+          subIndex
+        ].fieldList.findIndex((findItem) => String(findItem) === String(element.id))
+        if (fieldAll && findindex == -1) {
+          this.actionList[index].children[subIndex].fieldList.push(String(element.id))
+        } else if (!fieldAll && findindex > -1) {
+          this.actionList[index].children[subIndex].fieldList.splice(findindex, 1)
+        }
+      })
+    },
+    // 复选框组内的选中/不选中
+    handleCheckedGroupChange(event, index, item, subIndex) {
+      this.actionList[index].children[subIndex].checkAll = this.actionList[
+        index
+      ].children[subIndex].action.every(
+        (evitem) =>
+          this.actionList[index].children[subIndex].checkList.findIndex(
+            (finditem) => String(finditem) === String(evitem.id)
+          ) > -1
+      )
+      this.$set(this.actionList, index, item)
+    },
+    // 复选框组内的选中/不选中
+    handleFieldGroupChange(event, index, item, subIndex) {
+      this.actionList[index].children[subIndex].fieldAll = this.actionList[
+        index
+      ].children[subIndex].action_data.every(
+        (evitem) =>
+          this.actionList[index].children[subIndex].fieldList.findIndex(
+            (finditem) => String(finditem) === String(evitem.id)
+          ) > -1
+      )
+      this.$set(this.actionList, index, item)
+    },
+
+    // 单项复选框选中/不选中
+
+    handleCheckedChange(checked, id, index, subIndex, item) {
+      // console.log(checked, id, index, subIndex);
+      if (checked) {
+        // 选中时检查pid的选中状态
+        this.actionList[index].children[subIndex].checkList.indexOf(id) == -1 &&
+          this.actionList[index].children[subIndex].checkList.push(id)
+      } else {
+        const find = this.actionList[index].children[subIndex].checkList.findIndex(
+          (e) => String(e) == String(id)
+        )
+        if (find > -1) {
+          this.actionList[index].children[subIndex].checkList.splice(find, 1)
+        }
+        this.actionList[index].children[subIndex].checkAll = false
+      }
+      this.$set(this.actionList, index, item)
+    },
+    // 单项复选框选中/不选中
+    handleFieldChange(checked, id, index, subIndex, item) {
+      // console.log(checked, id, index, subIndex);
+      if (checked) {
+        // 选中时检查pid的选中状态
+        this.actionList[index].children[subIndex].fieldList.indexOf(id) == -1 &&
+          this.actionList[index].children[subIndex].fieldList.push(id)
+      } else {
+        const find = this.actionList[index].children[subIndex].fieldList.findIndex(
+          (e) => e == id
+        )
+        if (find > -1) {
+          this.actionList[index].children[subIndex].fieldList.splice(find, 1)
+        }
+        this.actionList[index].children[subIndex].fieldAll = false
+      }
+      this.$set(this.actionList, index, item)
+      // console.log(this.actionList[index].children[subIndex]);
+    },
+
+    async initForm() {
+      this.loading = true
+      if (this.id === 'add') {
+        this.title = '添加角色'
+        // this.ruleForm.isAdmin = 0;
+        this.rulesThis = this.rules
+        await this.resetForm()
+        await this.initActionList()
+        this.loading = false
+      } else {
+        if (this.isDetail) {
+          this.title = '角色'
+          this.rulesThis = {}
+        } else {
+          this.title = '修改角色'
+          this.rulesThis = this.rules
+        }
+        await this.resetForm()
+        await this.initActionList()
+        await this.initData()
+        this.loading = false
+      }
+    },
+    async initData() {
+      const res = await asyncRequest.detail({ roleid: this.id })
+      
+      const { role_name } = this.sitem
+      this.ruleForm.role_name = role_name
+
+      if (res && res.code === 1 && res.data) {
+        const resD = res.data
+
+        resD.private_field = !resD.private_field ? [] : resD.private_field.split(',')
+
+        if (resD.action && resD.action.length > 0) {
+          this.action = resD.action
+        } else {
+          this.action = []
+        }
+        if (resD.action_data && resD.action_data.length > 0) {
+          this.action_data = resD.action_data
+        } else {
+          this.action_data = []
+        }
+        if (resD.private_data === '') {
+          resD.private_data = []
+        }
+        if (resD.private_data && resD.private_data.length > 0) {
+          this.private_data = resD.private_data
+        } else {
+          this.private_data = []
+        }
+
+        this.ruleForm.is_allow_see_price = String(resD.is_allow_see_price)
+
+        const arr = JSON.parse(JSON.stringify(this.actionList))
+        arr.map((x) => {
+          if (x.children && x.children.length > 0) {
+            x.children.map((y) => {
+              if (y.action && y.action.length > 0) {
+                y.action.map((z) => {
+                  const Aindex = this.action.findIndex((a) => String(a) === String(z.id))
+                  if (Aindex !== -1) {
+                    y.checkList.push(this.action[Aindex])
+                  }
+                  return z
+                })
+                if (y.action.length === y.checkList.length) {
+                  y.checkAll = true
+                }
+              }
+              if (y.action_data && y.action_data.length > 0) {
+                y.action_data.map((z) => {
+                  const Bindex = this.action_data.findIndex((a) => String(a) === String(z.id))
+                  if (Bindex !== -1) {
+                    y.fieldList.push(this.action_data[Bindex])
+                  }
+                  return z
+                })
+                if (y.action_data.length === y.fieldList.length) {
+                  y.fieldAll = true
+                }
+              }
+              if (y.private && y.private.length === 2) {
+                const Cindex = this.private_data.findIndex((a) => String(a) === String(y.id))
+                if (Cindex !== -1) {
+                  y.is_private_change = '1'
+                } else {
+                  y.is_private_change = '0'
+                }
+              } else {
+                y.is_private_change = '0'
+              }
+              return y
+            })
+          }
+          return x
+        })
+
+        if (!this.ruleForm.private_field) this.ruleForm.private_field = []
+
+        this.actionList = arr
+      }
+    },
+    recursionFilterActionList(list) {
+      const _list = []
+      for (let i = 0; i < list.length; i++) {
+        const item = list[i]
+
+        if (item.level !== 1) _list.push(item)
+        if (item.children && item.children.length > 0) item.children = this.recursionFilterActionList(item.children)
+      }
+      return _list
+    },
+
+    async initActionList() {
+      const res = await asyncRequest.actionList({ })
+      if (res && res.code === 1) {
+        const list = res.data
+        let arr = list.filter((item) => item.children && item.children.length > 0)
+        arr = arr.map((x) => {
+          x.children.map((y) => {
+            y.checkAll = false
+            y.checkList = []
+            y.fieldAll = false
+            y.fieldList = []
+            y.is_private_change = '0'
+            if (y.is_private === '0') {
+              y.private = []
+            } else {
+              y.private = [
+                {
+                  id: '0',
+                  label: '公有数据'
+                },
+                {
+                  id: '1',
+                  label: '私有数据'
+                }
+              ]
+            }
+            return y
+          })
+          return x
+        })
+
+        console.log(arr)
+
+        this.actionList = arr
+      }
+    },
+    async resetForm() {
+      // 重置
+      await this.$nextTick(() => {
+        if (this.$refs.ruleForm) {
+          this.$refs.ruleForm.resetFields()
+          this.$refs.ruleForm.clearValidate()
+
+          this.ruleForm = {
+            role_name: '',
+            private_field: [],
+            is_allow_see_price: '1',
+            level: '2'
+          }
+        }
+      })
+    },
+    async submitForm() {
+      await this.$refs.ruleForm.validate(async(valid) => {
+        if (valid) {
+          if (this.loading) {
+            return
+          }
+          this.action_data = [] // 字段数据
+          this.action = [] // 功能数据
+          const arr = []
+          this.actionList.forEach((x) => {
+            x.children.forEach((y) => {
+              this.action_data.push(...y.fieldList)
+              this.action.push(...y.checkList)
+              if (y.is_private_change === '1') {
+                arr.push(y.id)
+              }
+            })
+          })
+          // this.action_data.length === 0 ||和字段
+          if (this.action.length === 0 && false) {
+            this.$message.warning('请选择功能!')
+          } else {
+            this.loading = true
+
+              // action: this.action,
+              // action_data: this.action_data,
+
+            const model = {
+              id: this.id,
+              role_name: this.ruleForm.role_name,
+            }
+
+            let res = {}
+
+            if (this.id === 'add') {
+              delete model['roleid']
+              res = await asyncRequest.add(model)
+            } else {
+              res = await asyncRequest.update(model)
+            }
+            this.loading = false
+            if (res && res.code === 1) {
+              const title = this.id === 'add' ? '添加成功' : '修改成功'
+              this.$notify.success({
+                title,
+                message: ''
+              })
+              this.showModelThis = false
+              // 刷新
+              this.$emit('refresh')
+            }
+          }
+        } else {
+          console.log('error submit!!')
+          return false
+        }
+      })
+    }
+  }
+}
+</script>
+
+   <style lang="scss" scoped>
+.role {
+  .quanxian-main {
+    width: 100%;
+    display: flex;
+    .quanxian-title {
+      width: 84px;
+      position: relative;
+      padding: 8px 0 0 7px;
+    }
+
+    .rule-view {
+      width: calc(100% - 84px);
+      position: relative;
+      height: 550px;
+      overflow-y: scroll;
+      border-top: 1px solid #dfe6ec;
+      border-left: 1px solid #dfe6ec;
+      // padding: 0 0 0 16px;
+      .ffff {
+        width: 100%;
+        display: flex;
+        align-items: stretch;
+        .ftitle {
+          width: 110px;
+          text-align: center;
+          border-right: 1px solid #dfe6ec;
+          border-bottom: 1px solid #dfe6ec;
+          padding: 12px 14px;
+          display: flex;
+          align-items: center;
+          span {
+            display: inline-block;
+            width: 100%;
+            font-size: 17px;
+            text-align: center;
+            color: #97a8be;
+          }
+        }
+        .fbody {
+          width: calc(100% - 110px);
+          .fbody-item {
+            border-right: 1px solid #dfe6ec;
+            border-bottom: 1px solid #dfe6ec;
+
+            .stitle {
+              padding: 18px 18px 12px 18px;
+              border-bottom: 1px dashed #dfe6ec;
+              font-size: 14px;
+              color: #97a8be;
+              ._h2 {
+                display: inline-block;
+                // width: 100px;
+              }
+            }
+            .scheck {
+              padding: 15px 0 10px 0;
+              display: flex;
+              width: 100%;
+              .checkAll {
+                width: 140px;
+                text-align: right;
+                padding: 0 35px 0 0;
+              }
+              .checkItem {
+                width: calc(100% - 140px);
+              }
+            }
+            .sfield {
+              padding: 0 0 10px 0;
+              display: flex;
+              width: 100%;
+              .checkAll {
+                width: 140px;
+                text-align: right;
+                padding: 0 35px 0 0;
+              }
+              .checkItem {
+                width: calc(100% - 140px);
+              }
+            }
+          }
+        }
+      }
+      // .rule-list {
+      //   height: 100%;
+      //   overflow-y: auto;
+      //   padding: 0 0 80px 0;
+      //   .rule-title {
+      //     .title {
+      //       font-size: 20px;
+      //       color: #333;
+      //     }
+      //     .desc {
+      //       margin: 10px 0;
+      //       font-size: 12px;
+      //       color: #999;
+      //     }
+      //   }
+      //   .rule-item {
+      //     .title {
+      //       margin: 30px 30px 10px 0;
+      //       font-size: 18px;
+      //       padding-bottom: 12px;
+      //       border-bottom: 1px solid #eee;
+      //       color: #333;
+      //       .el-checkbox {
+      //         margin-left: 10px;
+      //       }
+      //     }
+      //     .el-checkbox-group {
+      //       margin: 10px 30px 30px 0;
+      //       .el-checkbox {
+      //         line-height: 30px;
+      //       }
+      //       .children-checkbox-hr {
+      //         margin: 8px 0;
+      //         border: none;
+      //         border-top: 2px dotted #eee;
+      //       }
+      //     }
+      //   }
+      // }
+    }
+  }
+}
+</style>

+ 355 - 0
src/views/system/role/index.vue

@@ -0,0 +1,355 @@
+<template>
+  <div class="role pagePadding">
+    <ex-table
+      v-loading="loading"
+      :table="table"
+      :data="tableData"
+      :columns="columns"
+      :page="pageInfo"
+      :size="size"
+      @page-curr-change="handlePageChange"
+      @page-size-change="handleSizeChange"
+      @screen-reset="
+        pageInfo.curr = 1;
+        searchList();
+      "
+      @screen-submit="
+        pageInfo.curr = 1;
+        searchList();
+      "
+    >
+      <template #table-header="{}">
+        <div style="width: 100%">
+          <el-row>
+            <el-col :span="24" style="padding: 0 0 0 80px">
+              <el-col :span="3" style="width: 120px">
+                <el-select
+                  v-model="parmValue.status"
+                  filterable
+                  clearable
+                  :size="searchSize"
+                  placeholder="角色状态"
+                  style="width: 100%"
+                  @change="
+                    pageInfo.curr = 1;
+                    parmValue.page = 1;
+                    searchList();
+                  "
+                >
+                  <el-option
+                    v-for="item in statusList"
+                    :key="'status' + item.code"
+                    :label="item.name"
+                    :value="item.code"
+                  />
+                </el-select>
+              </el-col>
+              <el-col :span="3" style="width: 150px; padding: 0 0 0 10px">
+                <el-input
+                  :size="searchSize"
+                  v-model="parmValue.role_name"
+                  :maxlength="40"
+                  placeholder="角色名称"
+                />
+              </el-col>
+              <el-col :span="3" style="width: 54px">
+                <el-button
+                  type="primary"
+                  class="fr"
+                  :size="searchSize"
+                  icon="el-icon-search"
+                  @click="searchList"
+                />
+              </el-col>
+              <el-col :span="3" style="width: 66px">
+                <el-button
+                  type="warning"
+                  class="fr"
+                  :size="searchSize"
+                  @click="restSearch"
+                  >重置</el-button
+                >
+              </el-col>
+              <el-col :span="3" style="width: 66px; float: right">
+                <el-button
+                  type="primary"
+                  :size="searchSize"
+                  style="float: right"
+                  @click="searchList"
+                  >刷新</el-button
+                >
+              </el-col>
+              <el-col
+                :span="3"
+                style="width: 66px; float: right"
+              >
+                <el-button
+                  :size="searchSize"
+                  type="success"
+                  style="float: right"
+                  @click="openModal('add', false, {})"
+                  >添加</el-button
+                >
+              </el-col>
+            </el-col>
+          </el-row>
+        </div>
+      </template>
+      <template #status="{ scope }">
+        <el-tag
+          :size="tablebtnSize"
+          :type="scope.row.status == '0' ? 'warning' : ''"
+          v-text="
+            (statusOptions.find((item) => item.id == String(scope.row.status)) || {})
+              .label || '--'
+          "
+        ></el-tag>
+      </template>
+
+      <template #operation="{ scope }">
+        <el-tooltip
+          effect="dark"
+          content="详情"
+          placement="top"
+        >
+          <i class="el-icon-view tb-icon" @click="openModal(scope.row.id, true, scope.row)"></i>
+        </el-tooltip>
+        <el-tooltip
+         v-if="powers.some((i) => i == '005')"
+          effect="dark"
+          content="修改"
+          placement="top"
+        >
+          <i class="el-icon-edit tb-icon" @click="openModal(scope.row.id, false, scope.row)"></i>
+        </el-tooltip>
+        <el-tooltip
+          v-if="String(scope.row.status) === '1' && powers.some((i) => i == '004')"
+          effect="dark"
+          content="禁用"
+          placement="top"
+        >
+          <i
+            class="el-icon-video-pause tb-icon"
+            @click="changeStatus(scope.row.id, scope.row.status)"
+          ></i>
+        </el-tooltip>
+        <el-tooltip
+         v-if="String(scope.row.status) === '0' && powers.some((i) => i == '003')"
+          effect="dark"
+          content="启用"
+          placement="top"
+        >
+          <i
+            class="el-icon-video-play tb-icon"
+            @click="changeStatus(scope.row.id, scope.row.status)"
+          ></i>
+        </el-tooltip>
+
+        <el-tooltip
+        v-if="powers.some((i) => i == '006')"
+          effect="dark"
+          content="删除"
+          placement="top"
+        >
+          <i
+            class="el-icon-delete tb-icon"
+            @click="deleteRole(scope.row)"
+          ></i>
+        </el-tooltip>
+      </template>
+    </ex-table>
+
+    <!-- 弹窗 新增/修改 -->
+    <add-edit
+      :id="modelId"
+      :sitem="sitem"
+      :show-model="showModel"
+      :is-detail="isDetail"
+      @refresh="searchList"
+      @cancel="showModel = false"
+    />
+  </div>
+</template>
+<script>
+import addEdit from "./addEdit";
+import asyncRequest from "@/apis/service/system/role";
+import { statusList } from "@/assets/js/statusList";
+import roleLevel from "@/assets/js/roleLevel";
+import mixinPage from "@/mixins/elPaginationHandle";
+import resToken from "@/mixins/resToken";
+import { mapGetters } from "vuex";
+
+export default {
+  name: "role",
+  mixins: [mixinPage, resToken],
+  components: {
+    addEdit,
+  },
+  computed: {
+    //组件SIZE设置
+    ...mapGetters(["tablebtnSize", "searchSize", "size"]),
+    powers() {
+      const { btnList } = this.$store.getters;
+      const tran = btnList.find((i) => i.menu_route == "role") || {};
+      const { action } = tran ?? {};
+      return action ?? [];
+    },
+  },
+  data() {
+    return {
+      statusList: statusList,
+      roleLevel: roleLevel,
+      loading: true,
+      showModel: false,
+      isDetail: false,
+      modelId: 0,
+      parmValue: {
+        role_name: "",
+        page: 1, // 页码
+        size: 15, // 每页显示条数
+      },
+      sitem:{},
+      // 状态
+      statusOptions: [
+        { id: 0, label: "禁用" },
+        { id: 1, label: "启用" },
+      ],
+      // 表格 - 数据
+      tableData: [],
+      // 表格 - 参数
+      table: {
+        stripe: true,
+        border: true,
+        _defaultHeader_: ["setcol"],
+      },
+      // 表格 - 分页
+      pageInfo: {
+        size: 15,
+        curr: 1,
+        total: 0,
+      },
+      // 表格 - 列参数
+      columns: [
+        {
+          prop: "role_name",
+          label: "角色名称",
+        },
+        {
+          prop: "addtime",
+          label: "创建时间",
+        },
+        {
+          prop: "status",
+          label: "状态",
+          _slot_: "status",
+        },
+        {
+          prop: "",
+          label: "操作",
+          fixed: "right",
+          width: "145px",
+          _noset_: true,
+          _slot_: "operation",
+        },
+      ],
+    };
+  },
+  mounted() {
+    this.searchList();
+  },
+  methods: {
+    restSearch() {
+      // 表格 - 分页
+      this.pageInfo = {
+        size: 15,
+        curr: 1,
+        total: 0,
+      };
+      this.parmValue = {
+        status: "", // 账户
+        level: "2", // 姓名
+        role_name: "",
+        page: 1, // 页码
+        size: 15, // 每页显示条数
+      };
+      this.searchList();
+    },
+    // 新建/编辑/详情
+    openModal(id, isDetail, sitem) {
+      this.showModel = true;
+      this.modelId = id;
+      this.isDetail = isDetail;
+      this.sitem = sitem
+    },
+    /**
+     * 启用/禁用
+     * @param {String} id id
+     * @param {String} status 0-禁用 1-启用
+     */
+    async changeStatus(id, status) {
+      await this.$confirm(`确定要改为${status + "" === "1" ? "禁用" : "启用"}?`, {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(async () => {
+          const model = {
+            id: id,
+            status: status + "" === "1" ? "0" : "1",
+          };
+          const res = await asyncRequest.status(model);
+          if (res && res.code === 1) {
+            this.$notify.success({
+              title: "状态修改成功",
+              message: "",
+            });
+            this.searchList();
+          }
+        })
+        .catch(() => {
+          console.log("取消");
+        });
+    },
+
+    async deleteRole(row) {
+      await this.$confirm(`确定要删除角色 ${row.role_name} ?`, {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(async () => {
+
+          const model = { id:row.id };
+          const res = await asyncRequest.delete(model);
+          if (res && res.code === 1) {
+            this.$notify.success({
+              title: "删除成功!",
+              message: "",
+            });
+            this.searchList();
+          }
+        })
+        .catch(() => {
+          console.log("取消");
+        });
+    },
+
+    // 刷新表格
+    async searchList() {
+      this.loading = true;
+      const res = await asyncRequest.list(this.parmValue);
+
+      if (res && res.code === 1 && res.data) {
+        this.tableData = res.data.list;
+        this.pageInfo.total = Number(res.data.count);
+      } else {
+        this.tableData = [];
+        this.pageInfo.total = 0;
+      }
+      this.loading = false;
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped></style>

+ 0 - 0
src/views/system/role/角色管理


+ 25 - 41
src/views/system/setBtn/addEdit.vue

@@ -65,8 +65,9 @@
 
 <script>
 import asyncRequest from "@/apis/service/system/menu";
-import btnList from "@/assets/js/btnList";
+// import btnList from "@/assets/js/btnList";
 import resToken from "@/mixins/resToken";
+import action from '../../../apis/service/system/action';
 export default {
   mixins: [resToken],
   props: ["showModel", "type", "formData"],
@@ -75,26 +76,13 @@ export default {
       loading: false,
       showIconModel: false,
       title: "",
-      btnList,
+      btnList:[],
       showModelThis: this.showModel,
       ruleForm: {},
       rulesThis: this.rules,
       rules: {
-        action_code: [
-          {
-            required: true,
-            message: "请选择按钮",
-            trigger: "change",
-          },
-        ],
-
-        status: [
-          {
-            required: true,
-            message: "请选择状态",
-            trigger: "blur",
-          },
-        ],
+        action_code: [{ required: true, message: "请选择按钮", trigger: "change",}],
+        status: [{ required: true, message: "请选择状态", trigger: "blur" },]
       },
     };
   },
@@ -111,6 +99,9 @@ export default {
       }
     },
   },
+  mounted(){
+    this.requsetButtonList()
+  },
   methods: {
     codeChange(code) {
       for (let i = 0; i < this.btnList.length; i++) {
@@ -124,6 +115,16 @@ export default {
       this.ruleForm.status = val;
       this.$refs.ruleForm.validateField("status");
     },
+    async requsetButtonList(){
+      const { data, code } = await asyncRequest.actionQuery({})
+      console.log(data)
+      if(Number(code) === 1){
+        this.btnList = data.map(item => ({
+          name:item.action_name,
+          code:item.action_code
+        }))
+      }
+    },
     async initForm() {
       this.loading = false;
       // console.log(this.showModel, this.type, this.formData);
@@ -172,32 +173,19 @@ export default {
 
       await this.$refs.ruleForm.validate(async (valid) => {
         if (valid) {
-          // let model = {};
+          const model = JSON.parse(JSON.stringify(this.ruleForm))
+          model.menu_id = model.menuid
+          delete model['menuid']
           let res = {};
-          // const {
-          //   name,
-          //   status,
-          //   route,
-          //   status,
-          //   is_display,
-          //   weight,
-          //   component,
-          //   code,
-          //   level,
-          // } = this.ruleForm;
-
-          // if (this.type=='add') {
-          //   delete model["id"];
-          // }
-
           if (this.type == "add") {
-            res = await asyncRequest.actionadd(this.ruleForm);
+            console.log(model)
+            res = await asyncRequest.actionadd(model);
           } else {
-            res = await asyncRequest.actionedit(this.ruleForm);
+            res = await asyncRequest.actionedit(model);
           }
           this.loading = false;
           const { code: mcode, message } = res;
-          if (mcode === 0) {
+          if (mcode === 1) {
             this.ruleForm = {};
             const title = this.type == "add" ? "添加成功" : "修改成功";
             this.$notify.success({
@@ -206,10 +194,6 @@ export default {
             });
             this.showModelThis = false;
             this.$emit("refresh");
-          } else if (mcode >= 100 && mcode <= 104) {
-            await this.logout();
-          } else {
-            this.$message.warning(message);
           }
         } else {
           this.loading = false;

+ 50 - 45
src/views/system/setBtn/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="setBtn">
-    <div class="processPermission_show_box" v-if="powers.some((i) => i == '001')">
+    <div class="processPermission_show_box">
       <ul class="role-list fl" v-loading="menuLoading">
         <p class="role-list__title">菜单列表</p>
         <p
@@ -17,13 +17,15 @@
           highlight-current="true"
           :props="defaultProps"
           :current-node-key="keyId"
+           :default-expanded-keys="defaultExpandKeys"
           @node-click="handleNodeClick"
-        ></el-tree>
+          lazy
+          :load="load"
+        />
       </ul>
       <div class="rule-view fr">
         <ex-table
           v-loading="loading"
-          v-if="powers.some((i) => i == '001')"
           :table="table"
           :data="tableData"
           :columns="columns"
@@ -57,7 +59,7 @@
                   <el-col
                     :span="3"
                     style="width: 66px; float: right"
-                    v-if="powers.some((i) => i == '003')"
+                    v-if="powers.some((i) => i == '002')"
                   >
                     <el-button
                       :size="searchSize"
@@ -85,7 +87,6 @@
 
           <template #operation="{ scope }">
             <el-tooltip
-              v-if="powers.some((i) => i == '007')"
               effect="dark"
               content="详情"
               placement="top"
@@ -100,7 +101,7 @@
             >
               <i class="el-icon-edit tb-icon" @click="openModal('edit', scope.row)"></i>
             </el-tooltip>
-            <el-tooltip
+            <!-- <el-tooltip
               v-if="powers.some((i) => i == '004') && scope.row.status + '' === '1'"
               effect="dark"
               content="禁用"
@@ -112,7 +113,7 @@
               ></i>
             </el-tooltip>
             <el-tooltip
-              v-if="powers.some((i) => i == '004') && scope.row.status + '' === '0'"
+              v-if="powers.some((i) => i == '003') && scope.row.status + '' === '0'"
               effect="dark"
               content="启用"
               placement="top"
@@ -121,9 +122,9 @@
                 class="el-icon-video-play tb-icon"
                 @click="changeStatus(scope.row.id, scope.row.status)"
               ></i>
-            </el-tooltip>
+            </el-tooltip> -->
             <el-tooltip
-              v-if="powers.some((i) => i == '006')"
+              v-if="powers.some((i) => i == '005')"
               effect="dark"
               content="删除"
               placement="top"
@@ -141,9 +142,6 @@
         @cancel="showModel = false"
       />
     </div>
-    <div v-else>
-      <no-auth></no-auth>
-    </div>
   </div>
 </template>
 
@@ -171,12 +169,15 @@ export default {
   },
   data() {
     return {
+      currentNodeKey:"",
       defaultProps: {
         children: "child",
         label: "menu_name",
+        isLeaf:"isLeaf"
       },
+      isInit:true,
+      defaultExpandKeys:[],
       keyId: "",
-
       // 状态
       statusOptions: [
         { id: 0, label: "禁用" },
@@ -228,17 +229,16 @@ export default {
           prop: "action_code",
           label: "按钮编号",
         },
+        // {
+        //   prop: "status",
+        //   label: "状态",
+        //   _slot_: "status",
+        // },
 
-        {
-          prop: "status",
-          label: "状态",
-          _slot_: "status",
-        },
-
-        {
-          prop: "addtime",
-          label: "创建时间",
-        },
+        // {
+        //   prop: "addtime",
+        //   label: "创建时间",
+        // },
 
         {
           prop: "",
@@ -254,34 +254,47 @@ export default {
     this.getMenuList();
   },
   methods: {
+    async load(node,resolve){
+      console.log(111)
+      const { id: pid } = node.data
+      const { code, data } = await asyncRequest.list({pid});
+      if(code !== 1) return
+      resolve(data.map(item => ({ ...item, isLeaf: true })))
+      const hasFisrtChildren = pid === this.defaultExpandKeys[0] && data.length > 0
+      if(hasFisrtChildren && this.isInit){
+        this.handleNodeClick(data[0], 1)
+        this.isInit = false
+      }
+    },
     async getMenuList() {
       this.menuLoading = true;
       const { code, data } = await asyncRequest.list({});
       this.menuTableData = [];
-      if (code === 0) {
+      if (code === 1) {
         this.menuTableData = data;
-      } else if (code >= 100 && code <= 104) {
-        await this.logout();
       } else {
         this.menuTableData = [];
       }
       this.menuLoading = false;
       if (this.menuTableData.length > 0) {
-        this.handleNodeClick(this.menuTableData[0], 1);
+        this.defaultExpandKeys = [this.menuTableData[0].id] 
       } else {
         this.tableData = [];
         this.loading = false;
       }
     },
     async handleNodeClick(data, type) {
-      const { id, pid, child } = data;
+      const { id, pid, child = [] } = data;
+      this.currentNodeKey = id
       if (Number(pid) !== 0) {
         this.keyId = id;
         await this.searchList();
       } else {
-        if (type === 1 && child.length > 0) {
-          this.keyId = child[0].id;
-          await this.searchList();
+        if (type === 1) {
+          const { data,code} = await asyncRequest.list({ pid : id})
+          if(code !== 1 || data.length === 0) return
+          this.keyId = data[0].id
+          await this.searchList()
         }
       }
     },
@@ -309,17 +322,13 @@ export default {
           };
           const { code, message } = await asyncRequest.actionstatus(model);
 
-          if (code === 0) {
+          if (code === 1) {
             this.$notify.success({
               title: "修改成功!",
               message: "",
             });
             await this.searchList();
-          } else if (code >= 100 && code <= 104) {
-            await this.logout();
-          } else {
-            this.$message.warning(message);
-          }
+          } 
         })
         .catch(() => {
           console.log("取消");
@@ -335,15 +344,13 @@ export default {
           const model = {
             id: id,
           };
-          let res = await asyncRequest.actiondel(model);
-          if (res && res.code === 0) {
+          let res = await asyncRequest.actiondel(model); 
+          if (res && res.code === 1) {
             this.$notify.success({
               title: "删除成功!",
               message: "",
             });
             await this.searchList();
-          } else if (res && res.code >= 100 && res.code <= 104) {
-            await this.logout();
           }
         })
         .catch(() => {
@@ -353,12 +360,10 @@ export default {
 
     async searchList() {
       this.loading = true;
-      const res = await asyncRequest.actionList({ id: this.keyId });
+      const res = await asyncRequest.actionList({ menu_id: this.keyId });
       this.tableData = [];
-      if (res && res.code === 0 && res.data) {
+      if (res && res.code === 1 && res.data) {
         this.tableData = res.data;
-      } else if (res && res.code >= 100 && res.code <= 104) {
-        await this.logout();
       } else {
         this.tableData = [];
       }