update: 更新常用应用分页以及非空校验

This commit is contained in:
admin 2024-03-29 15:52:43 +08:00
parent 26e2e82669
commit 1dc643ca8a
18 changed files with 642 additions and 235 deletions

View File

@ -7,9 +7,10 @@
ref="form"
:labelWidth="100"
:labelStyle="{ padding: '0rpx 10rpx' }"
:errorType="'border-bottom'"
>
<u-form-item
:prop="`formData[${item.key}]`"
:prop="`formData.${item.key}`"
:label="item.name"
:required="item.required"
v-for="(item, index) in formAttrList"
@ -53,7 +54,6 @@
:closeOnClickAction="true"
:scroll="true"
></u-action-sheet>
</block>
</view>
<view class="btn-box">
@ -71,16 +71,40 @@ const model1 = reactive<any>({
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) {

View File

@ -7,9 +7,10 @@
ref="form"
:labelWidth="100"
:labelStyle="{ padding: '0rpx 10rpx' }"
:errorType="'border-bottom'"
>
<u-form-item
:prop="`formData[${item.key}]`"
:prop="`formData.${item.key}`"
:label="item.name"
:required="item.required"
v-for="(item, index) in formAttrList"
@ -69,16 +70,10 @@ const model1 = reactive<any>({
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<any>({
cardType: {
isShow: false,
title: "标题",
list: [{
id: 1,
name: '出库卡'
},{
id: 2,
name: '入库卡'
}],
}
list: [
{
id: 1,
name: "出库卡",
},
{
id: 2,
name: "入库卡",
},
],
},
});
const formAttrList = reactive<any>([
@ -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({

View File

@ -7,9 +7,10 @@
ref="form"
:labelWidth="100"
:labelStyle="{ padding: '0rpx 10rpx' }"
:errorType="'border-bottom'"
>
<u-form-item
:prop="`formData[${item.key}]`"
:prop="`formData.${item.key}`"
:label="item.name"
:required="item.required"
v-for="(item, index) in formAttrList"
@ -96,18 +97,12 @@ const model1 = reactive<any>({
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<any>({
checkedMap: {},
@ -121,6 +116,7 @@ const formAttrList = reactive<any>([
name: "角色名称",
key: "roleName",
type: "input",
required: true,
},
{
name: "权限配置",
@ -138,8 +134,32 @@ const formAttrList = reactive<any>([
// 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) {

View File

@ -7,9 +7,10 @@
ref="form"
:labelWidth="100"
:labelStyle="{ padding: '0rpx 10rpx' }"
:errorType="'border-bottom'"
>
<u-form-item
:prop="`formData[${item.key}]`"
:prop="`formData.${item.key}`"
:label="item.name"
:required="item.required"
v-for="(item, index) in formAttrList"
@ -81,21 +82,21 @@ import { formatDate } from "@/utils";
import { DeviceType, ImagesType, OrderType } from "@/utils/enum";
import { onLoad } from "@dcloudio/uni-app";
import _ from "underscore";
const { proxy } = getCurrentInstance();
const { proxy }: any = getCurrentInstance();
const model1 = reactive<any>({
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) {

View File

@ -7,9 +7,10 @@
ref="form"
:labelWidth="100"
:labelStyle="{ padding: '0rpx 10rpx' }"
:errorType="'border-bottom'"
>
<u-form-item
:prop="`formData[${item.key}]`"
:prop="`formData.${item.key}`"
:label="item.name"
:required="item.required"
v-for="(item, index) in formAttrList"
@ -69,16 +70,16 @@ const model1 = reactive<any>({
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<any>({
parent: {
isShow: false,
title: "标题",
list: [{
id: 0,
name: '主分类'
}],
}
list: [
{
id: 0,
name: "主分类",
},
],
},
});
const formAttrList = reactive<any>([
@ -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;

View File

@ -7,9 +7,10 @@
ref="form"
:labelWidth="100"
:labelStyle="{ padding: '0rpx 10rpx' }"
:errorType="'border-bottom'"
>
<u-form-item
:prop="`formData[${item.key}]`"
:prop="`formData.${item.key}`"
:label="item.name"
:required="item.required"
v-for="(item, index) in formAttrList"
@ -60,7 +61,7 @@
</template>
<script setup lang="ts">
import { StockCardApi } from "@/services";
import { formatDate } from "@/utils";
import { deleteBaseKey, formatDate } from "@/utils";
import { DeviceType, ImagesType, OrderType, StockCardType } from "@/utils/enum";
import { onLoad } from "@dcloudio/uni-app";
import _ from "underscore";
@ -69,31 +70,34 @@ const model1 = reactive<any>({
formData: {},
});
const rules = ref({
"userInfo.userName": {
"formData.cardCode": {
type: "string",
required: true,
message: "请输入手机号",
message: "请输入号",
trigger: ["blur", "change"],
},
"userInfo.password": {
"formData.typeName": {
type: "string",
required: true,
message: "请输入密码",
message: "请选择类型",
trigger: ["blur", "change"],
},
}
});
const contrlModalParams = reactive<any>({
cardType: {
isShow: false,
title: "标题",
list: [{
id: 1,
name: '出库卡'
},{
id: 2,
name: '入库卡'
}],
}
list: [
{
id: 1,
name: "出库卡",
},
{
id: 2,
name: "入库卡",
},
],
},
});
const formAttrList = reactive<any>([
@ -123,10 +127,34 @@ 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) {
StockCardApi.updateStockCard(model1.formData).then((res) => {
StockCardApi.updateStockCard({...deleteBaseKey(model1.formData)}).then((res) => {
if (res.code === 200) {
uni.redirectTo({
url: "/pagesApp/stockCard", //
@ -144,15 +172,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({

View File

@ -7,9 +7,10 @@
ref="form"
:labelWidth="100"
:labelStyle="{ padding: '0rpx 10rpx' }"
:errorType="'border-bottom'"
>
<u-form-item
:prop="`formData[${item.key}]`"
:prop="`formData.${item.key}`"
:label="item.name"
:required="item.required"
v-for="(item, index) in formAttrList"
@ -69,31 +70,28 @@ const model1 = reactive<any>({
formData: {},
});
const rules = ref({
"userInfo.userName": {
"formData.name": {
type: "string",
required: true,
message: "请输入手机号",
message: "请输入供应商分类",
trigger: ["blur", "change"],
},
"userInfo.password": {
type: "string",
required: true,
message: "请输入密码",
trigger: ["blur", "change"],
},
}
});
const contrlModalParams = reactive<any>({
cardType: {
isShow: false,
title: "标题",
list: [{
id: 1,
name: '出库卡'
},{
id: 2,
name: '入库卡'
}],
}
list: [
{
id: 1,
name: "出库卡",
},
{
id: 2,
name: "入库卡",
},
],
},
});
const formAttrList = reactive<any>([
@ -113,7 +111,33 @@ 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) {
SupplierApi.updateSupplierType(model1.formData).then((res) => {
if (res.code === 200) {
@ -133,15 +157,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({

View File

@ -7,9 +7,10 @@
ref="form"
:labelWidth="100"
:labelStyle="{ padding: '0rpx 10rpx' }"
:errorType="'border-bottom'"
>
<u-form-item
:prop="`formData[${item.key}]`"
:prop="`formData.${item.key}`"
:label="item.name"
:required="item.required"
v-for="(item, index) in formAttrList"
@ -70,13 +71,13 @@ const model1 = reactive<any>({
formData: {},
});
const rules = ref({
"userInfo.userName": {
"formData.userName": {
type: "string",
required: true,
message: "请输入手机号",
message: "请输入用户名",
trigger: ["blur", "change"],
},
"userInfo.password": {
"formData.password": {
type: "string",
required: true,
message: "请输入密码",
@ -92,14 +93,16 @@ const contrlModalParams = reactive<any>({
gender: {
isShow: false,
title: "标题",
list: [{
id: 1,
name: '男'
},
{
id: 2,
name: '女'
}],
list: [
{
id: 1,
name: "男",
},
{
id: 2,
name: "女",
},
],
},
});
@ -160,7 +163,33 @@ 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) {
ProfileApi.updateUserById(model1.formData).then((res) => {
if (res.code === 200) {
@ -170,7 +199,7 @@ const save = () => {
}
});
} else {
ProfileApi.addUser({userType: 1, ...model1.formData}).then((res) => {
ProfileApi.addUser({ userType: 1, ...model1.formData }).then((res) => {
if (res.code === 200) {
uni.redirectTo({
url: "/pagesApp/user", //

View File

@ -13,23 +13,36 @@
<view class="btn" @click="add"> 新增 </view>
</view>
<view class="box" v-for="(item, index) in pageList.list" :key="index">
<view>
<page-view
@loadList="
(v) => {
getList(v);
}
"
:noMoreData="pageList.noMoreData"
:list="pageList.list"
:height="100"
:isLoading="pageList.isLoading"
>
<view class="box" v-for="(item, index) in pageList.list" :key="index">
<view>
<view>{{ item.reProductsName }}</view>
<view>{{ item.minPrice }} ~ {{ item.maxPrice }} </view>
</view>
<view class="op-box">
<view class="btn" @click="edit(item)"> 编辑 </view>
<view class="btn" @click="update(item)"> 删除 </view>
<view>
<view>{{ item.reProductsName }}</view>
<view>{{ item.minPrice }} ~ {{ item.maxPrice }} </view>
</view>
<view class="op-box">
<view class="btn" @click="edit(item)"> 编辑 </view>
<view class="btn" @click="update(item)"> 删除 </view>
</view>
</view>
</view>
</view>
</page-view>
</view>
</template>
<script setup lang="ts">
import { GoodsApi } from "@/services";
import { UsersType } from "@/utils/enum";
import PageView from "@/components/PageView/index.vue";
const state = reactive<any>({
name: "",
supplierTypeId: -1,
@ -41,24 +54,33 @@ const pageList: PageResult<{
minPrice: number;
maxPrice: number;
}> = reactive({
isLoading: false,
noMoreData: false,
total: 0,
list: [],
pageNum: 1,
pageSize: 10,
});
const resetPageList = () => {
pageList.noMoreData = false;
pageList.total = 0;
pageList.list = [];
pageList.pageNum = 1;
pageList.pageSize = 10;
};
const handleSearch = () => {
resetPageList();
getList();
};
const update = (item: any) => {
GoodsApi.EditReceiveProduct({ isDeleted: true, id: item.id }).then(
(res) => {
if (res.code === 200) {
getList();
}
GoodsApi.EditReceiveProduct({ isDeleted: true, id: item.id }).then((res) => {
if (res.code === 200) {
resetPageList();
getList();
}
);
});
};
const edit = (item: any) => {
@ -68,17 +90,28 @@ const edit = (item: any) => {
JSON.stringify(item), //
});
};
const getList = () => {
const getList = (v?: boolean) => {
if (v) {
if (Math.ceil(pageList.total / pageList.pageSize) > pageList.pageNum) {
pageList.pageNum++;
} else {
pageList.noMoreData = true;
return;
}
}
let params: any = {
pageSize: 10,
pageNum: 1,
pageSize: pageList.pageSize,
pageNum: pageList.pageNum,
reProductsName: state.name,
};
GoodsApi.getReceiveProductListByPage(params).then((res) => {
pageList.isLoading = true;
GoodsApi.getReceiveProductListByPage(params).then((res:any) => {
if (res.code === 200) {
if (res.code === 200) {
(pageList as any).list = (res.data as any).list;
}
pageList.isLoading = false;
(pageList as any).list = (pageList as any).list = pageList.list.concat(
res.data.list
);
pageList.total = (res.data as any).total;
}
});
};

View File

@ -12,34 +12,54 @@
></u-search>
<view class="btn" @click="add"> 新增 </view>
</view>
<view class="box">
<view v-for="(item, index) in pageList.list" :key="index">
<view>
<view>{{ item.reCategoryName }}</view>
</view>
<view class="op-box">
<view class="btn" @click="edit(item)"> 编辑 </view>
<view class="btn" @click="deleteType(item)"> 删除 </view>
<page-view
@loadList="
(v) => {
getList(v);
}
"
:noMoreData="pageList.noMoreData"
:list="pageList.list"
:height="100"
:isLoading="pageList.isLoading"
>
<view class="box">
<view v-for="(item, index) in pageList.list" :key="index">
<view>
<view>{{ item.reCategoryName }}</view>
</view>
<view class="op-box">
<view class="btn" @click="edit(item)"> 编辑 </view>
<view class="btn" @click="deleteType(item)"> 删除 </view>
</view>
</view>
</view>
</view>
</page-view>
</view>
</template>
<script setup lang="ts">
import { GoodsApi } from "@/services";
import { StockCardType } from "@/utils/enum";
const keyword = ref("");
import PageView from "@/components/PageView/index.vue";
const state = reactive<any>({
name: "",
});
const pageList: PageResult<{reCategoryName: string}> = reactive({
const pageList: PageResult<{ reCategoryName: string }> = reactive({
isLoading: false,
noMoreData: false,
total: 0,
list: [],
pageNum: 1,
pageSize: 10,
});
const resetPageList = () => {
pageList.noMoreData = false;
pageList.total = 0;
pageList.list = [];
pageList.pageNum = 1;
pageList.pageSize = 10;
};
const add = () => {
uni.navigateTo({
url: "/pagesApp/components/addReceiveType", //
@ -55,27 +75,40 @@ const edit = (item: any) => {
const deleteType = (item: any) => {
GoodsApi.editReceiveCategory({ isDeleted: true, id: item.id }).then((res) => {
if (res.code === 200) {
resetPageList();
getList();
}
});
};
const handleSearch = () => {
resetPageList();
getList();
};
const getList = () => {
const getList = (v?: boolean) => {
if (v) {
if (Math.ceil(pageList.total / pageList.pageSize) > pageList.pageNum) {
pageList.pageNum++;
} else {
pageList.noMoreData = true;
return;
}
}
let params: any = {
pageSize: 10,
pageNum: 1,
pageSize: pageList.pageSize,
pageNum: pageList.pageNum,
reCategoryName: state.name,
};
if (state.supplierTypeId > -1) {
params.supplierTypeId = state.supplierTypeId;
}
GoodsApi.getPage(params).then((res) => {
pageList.isLoading = true;
GoodsApi.getPage(params).then((res:any) => {
if (res.code === 200) {
if (res.code === 200) {
(pageList as any).list = (res.data as any).list;
}
pageList.isLoading = false;
(pageList as any).list = (pageList as any).list = pageList.list.concat(
res.data.list
);
pageList.total = (res.data as any).total;
}
});
};

View File

@ -19,6 +19,9 @@
}
"
:noMoreData="pageList.noMoreData"
:list="pageList.list"
:height="100"
:isLoading="pageList.isLoading"
>
<view class="box">
<view v-for="(item, index) in pageList.list" :key="index">
@ -27,7 +30,7 @@
</view>
<view class="op-box">
<view class="btn" @click="edit(item)"> 编辑 </view>
<view class="btn" @click="deleteCustomer(item)"> 删除 </view>
<view class="btn" @click="deleteRole(item)"> 删除 </view>
</view>
</view>
</view>
@ -52,6 +55,13 @@ const pageList: PageResult<{
pageNum: 1,
pageSize: 10,
});
const resetPageList = () => {
pageList.noMoreData = false;
pageList.total = 0;
pageList.list = [];
pageList.pageNum = 1;
pageList.pageSize = 10;
};
const add = () => {
uni.navigateTo({
url: "/pagesApp/components/addRole", //
@ -64,14 +74,16 @@ const edit = (item: any) => {
JSON.stringify(item), //
});
};
const deleteCustomer = (item: any) => {
StockCardApi.updateStockCard({ isDeleted: true, id: item.id }).then((res) => {
const deleteRole = (item: any) => {
ProfileApi.updateRole({ isDeleted: true, id: item.id }).then((res) => {
if (res.code === 200) {
resetPageList()
getList();
}
});
};
const handleSearch = () => {
resetPageList()
getList();
};
const getList = (v?: boolean) => {
@ -92,7 +104,6 @@ const getList = (v?: boolean) => {
if (res.code === 200) {
pageList.isLoading = false;
(pageList as any).list = res.data as any;
pageList.total = (res.data as any).total
}
}
});

View File

@ -13,23 +13,38 @@
<view class="btn" @click="add"> 新增 </view>
</view>
<view class="box" v-for="(item, index) in pageList.list" :key="index">
<view>
<page-view
@loadList="
(v) => {
getList(v);
}
"
:noMoreData="pageList.noMoreData"
:list="pageList.list"
:height="100"
:isLoading="pageList.isLoading"
>
<view class="box" v-for="(item, index) in pageList.list" :key="index">
<view>
<view>{{ item.shmProductsName }}</view>
<view>分类{{ item.parentName }} / {{ item.shmCategoryName }} </view>
</view>
<view class="op-box">
<view class="btn" @click="edit(item)"> 编辑 </view>
<view class="btn" @click="update(item)"> 删除 </view>
<view>
<view>{{ item.shmProductsName }}</view>
<view
>分类{{ item.parentName }} / {{ item.shmCategoryName }}
</view>
</view>
<view class="op-box">
<view class="btn" @click="edit(item)"> 编辑 </view>
<view class="btn" @click="update(item)"> 删除 </view>
</view>
</view>
</view>
</view>
</page-view>
</view>
</template>
<script setup lang="ts">
import { GoodsApi } from "@/services";
import { UsersType } from "@/utils/enum";
import PageView from "@/components/PageView/index.vue";
const state = reactive<any>({
name: "",
supplierTypeId: -1,
@ -41,24 +56,32 @@ const pageList: PageResult<{
parentName: string;
shmCategoryName: string;
}> = reactive({
isLoading: false,
noMoreData: false,
total: 0,
list: [],
pageNum: 1,
pageSize: 10,
});
const resetPageList = () => {
pageList.noMoreData = false;
pageList.total = 0;
pageList.list = [];
pageList.pageNum = 1;
pageList.pageSize = 10;
};
const handleSearch = () => {
resetPageList();
getList();
};
const update = (item: any) => {
GoodsApi.EditReceiveProduct({ isDeleted: true, id: item.id }).then(
(res) => {
if (res.code === 200) {
getList();
}
GoodsApi.EditReceiveProduct({ isDeleted: true, id: item.id }).then((res) => {
if (res.code === 200) {
resetPageList();
getList();
}
);
});
};
const edit = (item: any) => {
@ -68,17 +91,26 @@ const edit = (item: any) => {
JSON.stringify(item), //
});
};
const getList = () => {
const getList = (v?: boolean) => {
if (v) {
if (Math.ceil(pageList.total / pageList.pageSize) > pageList.pageNum) {
pageList.pageNum++;
} else {
pageList.noMoreData = true;
return;
}
}
let params: any = {
pageSize: 10,
pageNum: 1,
pageSize: pageList.pageSize,
pageNum: pageList.pageNum,
name: state.name,
};
GoodsApi.getShipmentProductByPage(params).then((res) => {
GoodsApi.getShipmentProductByPage(params).then((res: any) => {
if (res.code === 200) {
if (res.code === 200) {
(pageList as any).list = (res.data as any).list;
}
(pageList as any).list = (pageList as any).list = pageList.list.concat(
res.data.list
);
pageList.total = (res.data as any).total;
}
});
};

View File

@ -19,6 +19,9 @@
}
"
:noMoreData="pageList.noMoreData"
:list="pageList.list"
:height="100"
:isLoading="pageList.isLoading"
>
<view class="box">
<view v-for="(item, index) in pageList.list" :key="index">
@ -38,19 +41,26 @@
import { GoodsApi } from "@/services";
import PageView from "@/components/PageView/index.vue";
const keyword = ref("");
const state = reactive<any>({
name: "",
});
const pageList: PageResult<{ reCategoryName: string }> = reactive({
isLoading: false,
noMoreData: false,
total: 0,
list: [],
pageNum: 1,
pageSize: 10,
});
const resetPageList = () => {
pageList.noMoreData = false;
pageList.total = 0;
pageList.list = [];
pageList.pageNum = 1;
pageList.pageSize = 10;
};
const add = () => {
uni.navigateTo({
url: "/pagesApp/components/addShipmentType", //
@ -71,19 +81,20 @@ const deleteType = (item: any) => {
});
};
const handleSearch = () => {
resetPageList()
getList();
};
const getList = (v?: boolean) => {
if (v) {
if (Math.ceil(pageList.total / pageList.pageSize) > pageList.pageNum) {
pageList.pageNum ++
if ( Math.ceil(pageList.total / pageList.pageSize) <= pageList.pageNum) {
pageList.noMoreData = true
pageList.pageNum++;
if (Math.ceil(pageList.total / pageList.pageSize) <= pageList.pageNum) {
pageList.noMoreData = true;
}
} else {
pageList.noMoreData = true
return
pageList.noMoreData = true;
return;
}
}
let params: any = {
@ -96,8 +107,10 @@ const getList = (v?: boolean) => {
}
GoodsApi.getPage(params).then((res) => {
if (res.code === 200) {
(pageList as any).list = (pageList as any).list.concat((res.data as any).list);
pageList.total = (res.data as any).total
(pageList as any).list = (pageList as any).list.concat(
(res.data as any).list
);
pageList.total = (res.data as any).total;
}
});
};

View File

@ -12,26 +12,45 @@
></u-search>
<view class="btn" @click="add"> 新增 </view>
</view>
<view class="box">
<view v-for="(item, index) in pageList.list" :key="index">
<view>
<view>{{item.type === StockCardType.Shipment ? '客户' : '供应商'}}{{ item.name }}</view>
<view>卡号{{ item.cardCode }}</view>
<view>类型{{ item.type === StockCardType.Shipment ? '出库卡' : '入库卡' }}</view>
</view>
<view class="op-box">
<view class="btn" @click="edit(item)"> 编辑 </view>
<view class="btn" @click="deleteCustomer(item)"> 删除 </view>
<page-view
@loadList="
(v) => {
getList(v);
}
"
:noMoreData="pageList.noMoreData"
:list="pageList.list"
:height="100"
:isLoading="pageList.isLoading"
>
<view class="box">
<view v-for="(item, index) in pageList.list" :key="index">
<view>
<view
>{{
item.type === StockCardType.Shipment ? "客户" : "供应商"
}}{{ item.name }}</view
>
<view>卡号{{ item.cardCode }}</view>
<view
>类型{{
item.type === StockCardType.Shipment ? "出库卡" : "入库卡"
}}</view
>
</view>
<view class="op-box">
<view class="btn" @click="edit(item)"> 编辑 </view>
<view class="btn" @click="deleteCustomer(item)"> 删除 </view>
</view>
</view>
</view>
</view>
</page-view>
</view>
</template>
<script setup lang="ts">
import { StockCardApi } from "@/services";
import { StockCardType } from "@/utils/enum";
const keyword = ref("");
import PageView from "@/components/PageView/index.vue";
const state = reactive<any>({
name: "",
@ -42,6 +61,13 @@ const pageList: PageResult<StockCard> = reactive({
pageNum: 1,
pageSize: 10,
});
const resetPageList = () => {
pageList.noMoreData = false;
pageList.total = 0;
pageList.list = [];
pageList.pageNum = 1;
pageList.pageSize = 10;
};
const add = () => {
uni.navigateTo({
url: "/pagesApp/components/addStockCard", //
@ -57,18 +83,28 @@ const edit = (item: any) => {
const deleteCustomer = (item: any) => {
StockCardApi.updateStockCard({ isDeleted: true, id: item.id }).then((res) => {
if (res.code === 200) {
resetPageList();
getList();
}
});
};
const handleSearch = () => {
resetPageList();
getList();
};
const getList = () => {
const getList = (v?: boolean) => {
if (v) {
if (Math.ceil(pageList.total / pageList.pageSize) > pageList.pageNum) {
pageList.pageNum++;
} else {
pageList.noMoreData = true;
return;
}
}
let params: any = {
pageSize: 10,
pageNum: 1,
name: state.name,
pageSize: pageList.pageSize,
pageNum: pageList.pageNum,
cardCode: state.name,
};
if (state.supplierTypeId > -1) {
params.supplierTypeId = state.supplierTypeId;

View File

@ -76,11 +76,11 @@ const resetPageList = () => {
};
const handleSelect = (v: any) => {
state.supplierTypeId = v.id;
resetPageList()
resetPageList();
getList();
};
const handleSearch = () => {
resetPageList()
resetPageList();
getList();
};
@ -88,7 +88,7 @@ const update = (item: any) => {
SupplierApi.updateSupplierUser({ isDeleted: true, id: item.id }).then(
(res) => {
if (res.code === 200) {
resetPageList()
resetPageList();
getList();
}
}
@ -120,18 +120,20 @@ const getList = (v?: boolean) => {
params.supplierTypeId = state.supplierTypeId;
}
pageList.isLoading = true;
SupplierApi.getSupplierUserPage(params).then((res) => {
SupplierApi.getSupplierUserPage(params).then((res: any) => {
if (res.code === 200) {
pageList.isLoading = false;
(pageList as any).list = (res.data as any).list;
(pageList as any).list = (pageList as any).list = pageList.list.concat(
res.data.list
);
pageList.total = (res.data as any).total;
}
});
};
const getSupplierTypeList = () => {
SupplierApi.getSupplierTypeList().then((res:any) => {
SupplierApi.getSupplierTypeList().then((res: any) => {
if (res.code === 200) {
state.typeList = [{id: -1, name: '全部'}].concat(res.data);
state.typeList = [{ id: -1, name: "全部" }].concat(res.data);
}
});
};

View File

@ -19,6 +19,9 @@
}
"
:noMoreData="pageList.noMoreData"
:list="pageList.list"
:height="100"
:isLoading="pageList.isLoading"
>
<view class="box">
<view v-for="(item, index) in pageList.list" :key="index">
@ -50,6 +53,13 @@ const pageList: PageResult<StockCard> = reactive({
pageNum: 1,
pageSize: 10,
});
const resetPageList = () => {
pageList.noMoreData = false;
pageList.total = 0;
pageList.list = [];
pageList.pageNum = 1;
pageList.pageSize = 10;
};
const add = () => {
uni.navigateTo({
url: "/pagesApp/components/addSupplierType", //
@ -66,20 +76,22 @@ const deleteType = (item: any) => {
SupplierApi.updateSupplierType({ isDeleted: true, id: item.id }).then(
(res) => {
if (res.code === 200) {
resetPageList();
getList();
}
}
);
};
const handleSearch = () => {
resetPageList();
getList();
};
const getList = (v?: boolean) => {
if (v) {
if (Math.ceil(pageList.total / pageList.pageSize) > pageList.pageNum) {
pageList.pageNum++;
if ( Math.ceil(pageList.total / pageList.pageSize) <= pageList.pageNum) {
pageList.noMoreData = true
if (Math.ceil(pageList.total / pageList.pageSize) <= pageList.pageNum) {
pageList.noMoreData = true;
}
} else {
pageList.noMoreData = true;
@ -94,10 +106,14 @@ const getList = (v?: boolean) => {
if (state.supplierTypeId > -1) {
params.supplierTypeId = state.supplierTypeId;
}
SupplierApi.getSupplierTypePage(params).then((res) => {
pageList.isLoading = true;
SupplierApi.getSupplierTypePage(params).then((res: any) => {
if (res.code === 200) {
if (res.code === 200) {
(pageList as any).list = (res.data as any).list;
pageList.isLoading = false;
(pageList as any).list = (pageList as any).list = pageList.list.concat(
res.data.list
);
pageList.total = (res.data as any).total;
}
}

View File

@ -168,6 +168,15 @@ export const addShipmentProduct = (data: any) => {
})
}
// 出货产品编辑
export const editShipmentProduct = (data: any) => {
return http({
method: 'POST',
url: '/api/shmproducts/edit',
data,
})
}
// 出货产品分页查询
export const getShipmentProductByPage = (data: any) => {
return http({

View File

@ -59,10 +59,10 @@ export const addRole = (data: { roleCode: string; roleName: string }) => {
};
// 修改角色
export const updateRole = (data: {
id: string;
roleCode: string;
roleName: string;
isDeleted: string;
id?: string;
roleCode?: string;
roleName?: string;
isDeleted?: boolean;
}) => {
return http({
method: "POST",