From 824b4de324b668734d8b8886f081c4131795730c Mon Sep 17 00:00:00 2001 From: admin <> Date: Tue, 19 Mar 2024 10:15:47 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=20=E4=BA=BA=E5=91=98=E6=9D=83?= =?UTF-8?q?=E9=99=90=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages.json | 12 ++ src/pagesApp/components/addRole.vue | 215 ++++++++++++++++++++++++++ src/pagesApp/components/addUser.vue | 89 +++++++---- src/pagesApp/role.vue | 138 +++++++++++++++++ src/pagesApp/user.vue | 3 +- src/pagesHome/index.vue | 6 +- src/pagesReceive/form/pricingForm.vue | 2 +- src/services/profile.ts | 3 +- src/static/style/common.scss | 2 +- 9 files changed, 432 insertions(+), 38 deletions(-) create mode 100644 src/pagesApp/components/addRole.vue create mode 100644 src/pagesApp/role.vue diff --git a/src/pages.json b/src/pages.json index 0f653a3..da2d24a 100644 --- a/src/pages.json +++ b/src/pages.json @@ -353,6 +353,12 @@ "navigationBarTitleText": "人员管理" } }, + { + "path": "role", + "style": { + "navigationBarTitleText": "权限管理" + } + }, { "path": "components/addSupplierType", "style": { @@ -406,6 +412,12 @@ "style": { "navigationBarTitleText": "新增人员" } + }, + { + "path": "components/addRole", + "style": { + "navigationBarTitleText": "新增权限" + } } ] } diff --git a/src/pagesApp/components/addRole.vue b/src/pagesApp/components/addRole.vue new file mode 100644 index 0000000..49e47e0 --- /dev/null +++ b/src/pagesApp/components/addRole.vue @@ -0,0 +1,215 @@ + + + diff --git a/src/pagesApp/components/addUser.vue b/src/pagesApp/components/addUser.vue index d95a781..8cfaed9 100644 --- a/src/pagesApp/components/addUser.vue +++ b/src/pagesApp/components/addUser.vue @@ -23,6 +23,7 @@ > -import { StockCardApi } from "@/services"; +import { ProfileApi, StockCardApi } from "@/services"; import { formatDate } from "@/utils"; import { DeviceType, ImagesType, OrderType, StockCardType } from "@/utils/enum"; import { onLoad } from "@dcloudio/uni-app"; @@ -83,69 +84,79 @@ const rules = ref({ }, }); const contrlModalParams = reactive({ - cardType: { + role: { + isShow: false, + title: "标题", + list: [], + }, + gender: { isShow: false, title: "标题", list: [{ id: 1, - name: '出库卡' - },{ + name: '男' + }, + { id: 2, - name: '入库卡' + name: '女' }], - } + }, }); const formAttrList = reactive([ { name: "姓名", - key: "cardCode", + key: "name", type: "input", }, { name: "性别", - key: "typeName", + key: "genderName", type: "select", - childKey: "cardType", + childKey: "gender", fn: () => { - contrlModalParams.cardType.isShow = true; - contrlModalParams.cardType.title = "库存卡类型"; + contrlModalParams.gender.isShow = true; + contrlModalParams.gender.title = "选择性别"; }, }, { name: "用户角色", - key: "typeName", + key: "roleName", type: "select", - childKey: "cardType", + childKey: "role", fn: () => { - contrlModalParams.cardType.isShow = true; - contrlModalParams.cardType.title = "库存卡类型"; + contrlModalParams.role.isShow = true; + contrlModalParams.role.title = "选择角色"; }, }, { name: "用户名", - key: "cardCode", + key: "userName", type: "input", required: true, }, { name: "密码", - key: "cardCode", + key: "password", type: "input", required: true, }, { name: "联系手机", - key: "cardCode", + key: "phone", type: "input", }, ]); const handleSelect = (key: string, v: any) => { contrlModalParams[key].isShow = false; - if (key === "cardType") { - model1.formData.typeName = v.name; - model1.formData.type = v.id; + if (key === "role") { + model1.formData.roleName = v.name; + model1.formData.roleIds = [v.id]; + } + if (key === "gender") { + model1.formData.genderName = v.name; + model1.formData.genderId = v.id; } }; @@ -159,30 +170,46 @@ const save = () => { } }); } else { - StockCardApi.addStockCard(model1.formData).then((res) => { + ProfileApi.addUser({userType: 1, ...model1.formData}).then((res) => { if (res.code === 200) { uni.redirectTo({ - url: "/pagesApp/stockCard", // 要跳转到的页面路径 + url: "/pagesApp/user", // 要跳转到的页面路径 }); } }); } }; +const getRoleList = () => { + ProfileApi.getRoleList().then((res) => { + if (res.code === 200) { + contrlModalParams.role.list = (res.data as any).map((item: any) => { + return { ...item, name: item.roleName }; + }); + console.log(contrlModalParams.role.list); + } + }); +}; + +onMounted(() => { + getRoleList(); +}); onLoad((option) => { - // 接收传递的标题参数 + // 接收传递的标题参数; const title = (option as any).title; model1.formData = JSON.parse((option as any).item); if (model1.formData.type === 1) { - model1.formData.typeName = '出库卡' - }else if (model1.formData.type === 2) { - model1.formData.typeName = '入库卡' + model1.formData.typeName = "出库卡"; + } else if (model1.formData.type === 2) { + model1.formData.typeName = "入库卡"; + } + // 设置页面标题; + if (title) { + uni.setNavigationBarTitle({ + title: title, + }); } - // 设置页面标题 - uni.setNavigationBarTitle({ - title: title, - }); }); diff --git a/src/pagesApp/user.vue b/src/pagesApp/user.vue index e1d771e..872fbed 100644 --- a/src/pagesApp/user.vue +++ b/src/pagesApp/user.vue @@ -21,7 +21,8 @@ 编辑 - 删除 + 下线 + diff --git a/src/pagesHome/index.vue b/src/pagesHome/index.vue index 845c563..58660b8 100644 --- a/src/pagesHome/index.vue +++ b/src/pagesHome/index.vue @@ -426,9 +426,9 @@ const appList = reactive([ icon: "15.png", title: "权限管理", fn: () => { - // uni.navigateTo({ - // url: "/pagesApp/supplierMgt", // 要跳转到的页面路径 - // }); + uni.navigateTo({ + url: "/pagesApp/role", // 要跳转到的页面路径 + }); }, }, { diff --git a/src/pagesReceive/form/pricingForm.vue b/src/pagesReceive/form/pricingForm.vue index d466bcf..0a71897 100644 --- a/src/pagesReceive/form/pricingForm.vue +++ b/src/pagesReceive/form/pricingForm.vue @@ -409,7 +409,7 @@ const save = () => { box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(0, 56, 93, 0.12); border-radius: 13rpx 13rpx 0rpx 0rpx; padding: 25rpx 50rpx; - position: fixed; + position: sticky; bottom: 0rpx; z-index: 999; ::v-deep button { diff --git a/src/services/profile.ts b/src/services/profile.ts index 04861ff..3380675 100644 --- a/src/services/profile.ts +++ b/src/services/profile.ts @@ -72,10 +72,11 @@ export const updateRole = (data: { }; // 查询角色列表 -export const getRoleList = () => { +export const getRoleList = (data: any) => { return http({ method: "GET", url: "/api/role/getRoleList", + data }); }; diff --git a/src/static/style/common.scss b/src/static/style/common.scss index 2b36649..351c634 100644 --- a/src/static/style/common.scss +++ b/src/static/style/common.scss @@ -32,6 +32,6 @@ body { } .u-action-sheet > view:nth-child(2) { - height: 600rpx; + max-height: 600rpx; overflow-y: auto; }