From 1dc643ca8a75bba49cb580a28e832adfeae8ea46 Mon Sep 17 00:00:00 2001 From: admin <> Date: Fri, 29 Mar 2024 15:52:43 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E6=9B=B4=E6=96=B0=E5=B8=B8=E7=94=A8?= =?UTF-8?q?=E5=BA=94=E7=94=A8=E5=88=86=E9=A1=B5=E4=BB=A5=E5=8F=8A=E9=9D=9E?= =?UTF-8?q?=E7=A9=BA=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pagesApp/components/addReceiveProduct.vue | 61 ++++++++++++-- src/pagesApp/components/addReceiveType.vue | 63 ++++++++++----- src/pagesApp/components/addRole.vue | 54 +++++++++---- .../components/addShipmentProduct.vue | 57 +++++++++---- src/pagesApp/components/addShipmentType.vue | 50 +++++++++--- src/pagesApp/components/addStockCard.vue | 67 +++++++++++----- src/pagesApp/components/addSupplierType.vue | 67 ++++++++++------ src/pagesApp/components/addUser.vue | 55 ++++++++++--- src/pagesApp/receiveProduct.vue | 79 +++++++++++++------ src/pagesApp/receiveType.vue | 71 ++++++++++++----- src/pagesApp/role.vue | 19 ++++- src/pagesApp/shipmentProduct.vue | 78 ++++++++++++------ src/pagesApp/shipmentType.vue | 29 +++++-- src/pagesApp/stockCard.vue | 70 ++++++++++++---- src/pagesApp/supplierMgt.vue | 16 ++-- src/pagesApp/supplierType.vue | 24 +++++- src/services/goods.ts | 9 +++ src/services/profile.ts | 8 +- 18 files changed, 642 insertions(+), 235 deletions(-) diff --git a/src/pagesApp/components/addReceiveProduct.vue b/src/pagesApp/components/addReceiveProduct.vue index ac9bb72..b4e2be8 100644 --- a/src/pagesApp/components/addReceiveProduct.vue +++ b/src/pagesApp/components/addReceiveProduct.vue @@ -7,9 +7,10 @@ ref="form" :labelWidth="100" :labelStyle="{ padding: '0rpx 10rpx' }" + :errorType="'border-bottom'" > - @@ -71,16 +71,40 @@ const model1 = reactive({ formData: {}, }); const rules = ref({ - "userInfo.userName": { + "formData.reProductsName": { type: "string", required: true, - message: "请输入手机号", + message: "请输入货产品", trigger: ["blur", "change"], }, - "userInfo.password": { + "formData.reCategoryName": { type: "string", required: true, - message: "请输入密码", + message: "请选择收货分类", + trigger: ["blur", "change"], + }, + "formData.substationName": { + type: "string", + required: true, + message: "请输入所属分站", + trigger: ["blur", "change"], + }, + "formData.minPrice": { + type: "string", + required: true, + message: "请输入最低价", + trigger: ["blur", "change"], + }, + "formData.maxPrice": { + type: "string", + required: true, + message: "请输入最高价", + trigger: ["blur", "change"], + }, + "formData.commonPrice": { + type: "string", + required: true, + message: "请输入常用价格", trigger: ["blur", "change"], }, }); @@ -150,7 +174,32 @@ const handleSelect = (key: string, v: any) => { } }; +const form = ref(); +const check = () => { + return new Promise((resolve) => { + form.value + .validate() + .then((res: boolean) => { + resolve(res); + }) + .catch((errors: any) => { + resolve(false); + uni.showToast({ + icon: "none", + title: errors[0].message || "校验失败", + }); + }); + }); +}; + const save = () => { + check().then((res) => { + if (res) { + startSave(); + } + }); +}; +const startSave = () => { if (model1.formData.id) { GoodsApi.EditReceiveProduct(model1.formData).then((res) => { if (res.code === 200) { diff --git a/src/pagesApp/components/addReceiveType.vue b/src/pagesApp/components/addReceiveType.vue index 48cd0e5..ca30f86 100644 --- a/src/pagesApp/components/addReceiveType.vue +++ b/src/pagesApp/components/addReceiveType.vue @@ -7,9 +7,10 @@ ref="form" :labelWidth="100" :labelStyle="{ padding: '0rpx 10rpx' }" + :errorType="'border-bottom'" > ({ formData: {}, }); const rules = ref({ - "userInfo.userName": { + "formData.reCategoryName": { type: "string", required: true, - message: "请输入手机号", - trigger: ["blur", "change"], - }, - "userInfo.password": { - type: "string", - required: true, - message: "请输入密码", + message: "请输入收货分类", trigger: ["blur", "change"], }, }); @@ -86,14 +81,17 @@ const contrlModalParams = reactive({ cardType: { isShow: false, title: "标题", - list: [{ - id: 1, - name: '出库卡' - },{ - id: 2, - name: '入库卡' - }], - } + list: [ + { + id: 1, + name: "出库卡", + }, + { + id: 2, + name: "入库卡", + }, + ], + }, }); const formAttrList = reactive([ @@ -112,8 +110,32 @@ const handleSelect = (key: string, v: any) => { model1.formData.type = v.id; } }; +const form = ref(); +const check = () => { + return new Promise((resolve) => { + form.value + .validate() + .then((res: boolean) => { + resolve(res); + }) + .catch((errors: any) => { + resolve(false); + uni.showToast({ + icon: "none", + title: errors[0].message || "校验失败", + }); + }); + }); +}; const save = () => { + check().then((res) => { + if (res) { + startSave(); + } + }); +}; +const startSave = () => { if (model1.formData.id) { GoodsApi.editReceiveCategory(model1.formData).then((res) => { if (res.code === 200) { @@ -133,15 +155,14 @@ const save = () => { } }; - 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 = "入库卡"; } // 设置页面标题 uni.setNavigationBarTitle({ diff --git a/src/pagesApp/components/addRole.vue b/src/pagesApp/components/addRole.vue index 6b0f695..bdcb45b 100644 --- a/src/pagesApp/components/addRole.vue +++ b/src/pagesApp/components/addRole.vue @@ -7,9 +7,10 @@ ref="form" :labelWidth="100" :labelStyle="{ padding: '0rpx 10rpx' }" + :errorType="'border-bottom'" > ({ formData: {}, }); const rules = ref({ - "userInfo.userName": { + "formData.roleName": { type: "string", required: true, - message: "请输入手机号", + message: "请输入角色名称", trigger: ["blur", "change"], - }, - "userInfo.password": { - type: "string", - required: true, - message: "请输入密码", - trigger: ["blur", "change"], - }, + } }); const contrlModalParams = reactive({ checkedMap: {}, @@ -121,6 +116,7 @@ const formAttrList = reactive([ name: "角色名称", key: "roleName", type: "input", + required: true, }, { name: "权限配置", @@ -138,8 +134,32 @@ const formAttrList = reactive([ // model1.formData.roleIds = [v.id]; // } // }; +const form = ref(); +const check = () => { + return new Promise((resolve) => { + form.value + .validate() + .then((res: boolean) => { + resolve(res); + }) + .catch((errors: any) => { + resolve(false); + uni.showToast({ + icon: "none", + title: errors[0].message || "校验失败", + }); + }); + }); +}; const save = () => { + check().then((res) => { + if (res) { + startSave(); + } + }); +}; +const startSave = () => { let list: any = []; contrlModalParams.menu.list.forEach((item: any) => { item.childrenList.forEach((c: any) => { @@ -149,13 +169,15 @@ const save = () => { }); }); if (model1.formData.id) { - ProfileApi.updateRole({...deleteBaseKey(model1.formData), list}).then((res) => { - if (res.code === 200) { - uni.redirectTo({ - url: "/pagesApp/role", // 要跳转到的页面路径 - }); + ProfileApi.updateRole({ ...deleteBaseKey(model1.formData), list }).then( + (res) => { + if (res.code === 200) { + uni.redirectTo({ + url: "/pagesApp/role", // 要跳转到的页面路径 + }); + } } - }); + ); } else { ProfileApi.addRole({ ...model1.formData, list }).then((res) => { if (res.code === 200) { diff --git a/src/pagesApp/components/addShipmentProduct.vue b/src/pagesApp/components/addShipmentProduct.vue index 54ca567..c5dcd41 100644 --- a/src/pagesApp/components/addShipmentProduct.vue +++ b/src/pagesApp/components/addShipmentProduct.vue @@ -7,9 +7,10 @@ ref="form" :labelWidth="100" :labelStyle="{ padding: '0rpx 10rpx' }" + :errorType="'border-bottom'" > ({ formData: {}, }); const rules = ref({ - "userInfo.userName": { + "formData.shmProductsName": { type: "string", required: true, - message: "请输入手机号", + message: "请输入出货产品", trigger: ["blur", "change"], }, - "userInfo.password": { + "formData.reCategoryName": { type: "string", required: true, - message: "请输入密码", + message: "请选择出货分类", trigger: ["blur", "change"], }, }); @@ -154,21 +155,45 @@ const handleChange = (e: any) => { const confirm = (e: any) => { if (e.value[1]) { - model1.formData.shmCategoryId = e.value[1].id - model1.formData.reCategoryName = e.value[1].shmCategoryName - contrlModalParams['reCategory'].isShow = false + model1.formData.shmCategoryId = e.value[1].id; + model1.formData.reCategoryName = e.value[1].shmCategoryName; + contrlModalParams["reCategory"].isShow = false; } }; +const form = ref(); +const check = () => { + return new Promise((resolve) => { + form.value + .validate() + .then((res: boolean) => { + resolve(res); + }) + .catch((errors: any) => { + resolve(false); + uni.showToast({ + icon: "none", + title: errors[0].message || "校验失败", + }); + }); + }); +}; const save = () => { + check().then((res) => { + if (res) { + startSave(); + } + }); +}; +const startSave = () => { if (model1.formData.id) { - // GoodsApi.EditReceiveProduct(model1.formData).then((res) => { - // if (res.code === 200) { - // uni.redirectTo({ - // url: "/pagesApp/shipmentProduct", // 要跳转到的页面路径 - // }); - // } - // }); + GoodsApi.editShipmentProduct(model1.formData).then((res) => { + if (res.code === 200) { + uni.redirectTo({ + url: "/pagesApp/shipmentProduct", // 要跳转到的页面路径 + }); + } + }); } else { GoodsApi.addShipmentProduct(model1.formData).then((res) => { if (res.code === 200) { diff --git a/src/pagesApp/components/addShipmentType.vue b/src/pagesApp/components/addShipmentType.vue index 5d9950f..346831e 100644 --- a/src/pagesApp/components/addShipmentType.vue +++ b/src/pagesApp/components/addShipmentType.vue @@ -7,9 +7,10 @@ ref="form" :labelWidth="100" :labelStyle="{ padding: '0rpx 10rpx' }" + :errorType="'border-bottom'" > ({ formData: {}, }); const rules = ref({ - "userInfo.userName": { + "formData.parentName": { type: "string", required: true, - message: "请输入手机号", + message: "请选择上级菜单", trigger: ["blur", "change"], }, - "userInfo.password": { + "formData.shmCategoryName": { type: "string", required: true, - message: "请输入密码", + message: "请输入出货分类", trigger: ["blur", "change"], }, }); @@ -86,11 +87,13 @@ const contrlModalParams = reactive({ parent: { isShow: false, title: "标题", - list: [{ - id: 0, - name: '主分类' - }], - } + list: [ + { + id: 0, + name: "主分类", + }, + ], + }, }); const formAttrList = reactive([ @@ -120,8 +123,32 @@ const handleSelect = (key: string, v: any) => { model1.formData.parentId = v.id; } }; +const form = ref(); +const check = () => { + return new Promise((resolve) => { + form.value + .validate() + .then((res: boolean) => { + resolve(res); + }) + .catch((errors: any) => { + resolve(false); + uni.showToast({ + icon: "none", + title: errors[0].message || "校验失败", + }); + }); + }); +}; const save = () => { + check().then((res) => { + if (res) { + startSave(); + } + }); +}; +const startSave = () => { if (model1.formData.id) { GoodsApi.editReceiveCategory(model1.formData).then((res) => { if (res.code === 200) { @@ -131,7 +158,7 @@ const save = () => { } }); } else { - GoodsApi.addShmCategory({...model1.formData}).then((res) => { + GoodsApi.addShmCategory({ ...model1.formData }).then((res) => { if (res.code === 200) { uni.redirectTo({ url: "/pagesApp/shipmentType", // 要跳转到的页面路径 @@ -141,7 +168,6 @@ const save = () => { } }; - onLoad((option) => { // 接收传递的标题参数 const title = (option as any).title; diff --git a/src/pagesApp/components/addStockCard.vue b/src/pagesApp/components/addStockCard.vue index 3961b2e..15f4012 100644 --- a/src/pagesApp/components/addStockCard.vue +++ b/src/pagesApp/components/addStockCard.vue @@ -7,9 +7,10 @@ ref="form" :labelWidth="100" :labelStyle="{ padding: '0rpx 10rpx' }" + :errorType="'border-bottom'" >